mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 21:19:55 +00:00
Decompile RIC EntityGiantSpinningCross (#832)
This is actually the last function in RIC (by which I mean "There are no functions in RIC which are located later in the ROM than this one"), so that's neat. There was a mistake with the splat, where the nop in the delay slot for the return instruction of this function was being treated as the first 4 bytes of SBSS, rather than as the final instruction of this function, but luckily I worked that out and fixed it in the splat. This is extremely similar to the one in DRA. However, it stores to 0xB0 in the entity. This is interesting, I've seen that being a significant address in other RIC functions too. I added it to the extension that was used for this entity in DRA.
This commit is contained in:
parent
839f42433c
commit
4e0449ac6f
@ -65,5 +65,5 @@ segments:
|
||||
- [0x26C84, c, 26C84]
|
||||
- [0x32324, c, 32324]
|
||||
- [0x345EC, c, 345EC]
|
||||
- [0x37B60, sbss]
|
||||
- [0x37B64, sbss]
|
||||
- [0x39A58]
|
||||
|
@ -8,4 +8,5 @@ GetFreeEntity = 0x8015F8F8;
|
||||
GetFreeEntityReverse = 0x8015F96C;
|
||||
CreateEntFactoryFromEntity = 0x801606BC;
|
||||
EntitySubwpnBible = 0x80172D00;
|
||||
EntityGiantSpinningCross = 0x8017328C;
|
||||
g_DebugWaitInfoTimer = 0x80174F7C;
|
||||
|
@ -555,6 +555,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
/* 0x7C */ s16 unk7C;
|
||||
/* 0x7E */ s16 unk7E;
|
||||
/* 0x80 */ s16 pad[24];
|
||||
/* 0xB0 */ s16 unkB0;
|
||||
} ET_GiantSpinningCross;
|
||||
|
||||
typedef struct {
|
||||
|
@ -900,7 +900,7 @@ void EntityGiantSpinningCross(Entity* self) {
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
while (prim != NULL) {
|
||||
prim->tpage = 0x1C;
|
||||
prim->blendMode = 0x108;
|
||||
prim->blendMode = 0x100 | BLEND_VISIBLE;
|
||||
prim = prim->next;
|
||||
}
|
||||
func_8011A290(self);
|
||||
@ -916,8 +916,7 @@ void EntityGiantSpinningCross(Entity* self) {
|
||||
self->step++;
|
||||
primUVCoords = &D_800B0F94[0][0];
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
for (i = 0; i < 46; i++, prim = prim->next,
|
||||
primUVCoords += 5) { // i is t1
|
||||
for (i = 0; i < 46; i++, prim = prim->next, primUVCoords += 5) {
|
||||
prim->clut = (primUVCoords[4] & 0xF) | 0x1A0;
|
||||
switch (primUVCoords[4] & 0xF0) {
|
||||
case 0x10:
|
||||
@ -1041,7 +1040,7 @@ void EntityGiantSpinningCross(Entity* self) {
|
||||
temp_a3 = vectors_ptr[2];
|
||||
prim->type = 4;
|
||||
gte_nclip();
|
||||
prim->blendMode = 8;
|
||||
prim->blendMode = BLEND_VISIBLE;
|
||||
gte_stopz(&nclip);
|
||||
if (nclip < 0) {
|
||||
continue;
|
||||
|
194
src/ric/345EC.c
194
src/ric/345EC.c
@ -355,10 +355,6 @@ void func_80170F64(Entity* self) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Needs to be in between functions in this file with rodata
|
||||
// Can remove once all rodata is pulled in.
|
||||
const u32 rodataPadding_345EC = 0;
|
||||
|
||||
void func_8017161C(Entity* self) {
|
||||
Primitive* prim;
|
||||
s16 temp_s0_4;
|
||||
@ -1045,4 +1041,192 @@ void EntitySubwpnBible(Entity* self) {
|
||||
}
|
||||
}
|
||||
|
||||
INCLUDE_ASM("asm/us/ric/nonmatchings/345EC", func_8017328C);
|
||||
void EntityGiantSpinningCross(Entity* self) {
|
||||
MATRIX m;
|
||||
SVECTOR rot;
|
||||
VECTOR trans1;
|
||||
SVECTOR pos;
|
||||
SVECTOR sp50;
|
||||
s32 z;
|
||||
s32 nclip;
|
||||
Primitive* prim;
|
||||
s32 temp_v1;
|
||||
s32 i;
|
||||
u8* primUVCoords;
|
||||
SVECTOR* temp_a3;
|
||||
SVECTOR** vectors_ptr;
|
||||
u16 priority;
|
||||
|
||||
pos = D_80156C50;
|
||||
sp50 = D_80156C58;
|
||||
if (self->step == 0) {
|
||||
self->primIndex = g_api.func_800EDB58(PRIM_GT4, 46);
|
||||
if (self->primIndex == -1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
while (prim != NULL) {
|
||||
prim->tpage = 0x1C;
|
||||
prim->blendMode = 0x100 | BLEND_VISIBLE;
|
||||
prim = prim->next;
|
||||
}
|
||||
self->ext.giantcross.unkB0 = 0xD;
|
||||
func_8015FAB8(self);
|
||||
self->hitboxHeight = 0x50;
|
||||
self->hitboxWidth = 0xC;
|
||||
self->posY.i.hi = 0x160;
|
||||
self->velocityY = FIX(-6.0);
|
||||
self->flags = FLAG_UNK_04000000 | FLAG_HAS_PRIMS | FLAG_UNK_20000;
|
||||
self->facingLeft = 0;
|
||||
self->ext.giantcross.unk7C = 0;
|
||||
self->ext.giantcross.unk7E = 0x400;
|
||||
g_api.PlaySfx(0x661);
|
||||
self->step++;
|
||||
primUVCoords = &D_8015635C[0][0];
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
for (i = 0; i < 46; i++, prim = prim->next, primUVCoords += 5) {
|
||||
prim->clut = (primUVCoords[4] & 0xF) | 0x1A0;
|
||||
switch (primUVCoords[4] & 0xF0) {
|
||||
case 0x10:
|
||||
prim->u0 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v0 = primUVCoords[1];
|
||||
prim->u1 = primUVCoords[0];
|
||||
prim->v1 = primUVCoords[1];
|
||||
prim->u2 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v2 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u3 = primUVCoords[0];
|
||||
prim->v3 = primUVCoords[1] + primUVCoords[3];
|
||||
break;
|
||||
case 0x20:
|
||||
prim->u0 = primUVCoords[0];
|
||||
prim->v0 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u1 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v1 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u2 = primUVCoords[0];
|
||||
prim->v2 = primUVCoords[1];
|
||||
prim->u3 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v3 = primUVCoords[1];
|
||||
break;
|
||||
case 0x30:
|
||||
prim->u0 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v0 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u1 = primUVCoords[0];
|
||||
prim->v1 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u2 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v2 = primUVCoords[1];
|
||||
prim->u3 = primUVCoords[0];
|
||||
prim->v3 = primUVCoords[1];
|
||||
break;
|
||||
case 0x40:
|
||||
prim->u3 = primUVCoords[0];
|
||||
prim->v3 = primUVCoords[1];
|
||||
prim->u1 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v1 = primUVCoords[1];
|
||||
prim->u2 = primUVCoords[0];
|
||||
prim->v2 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u0 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v0 = primUVCoords[1] + primUVCoords[3];
|
||||
break;
|
||||
case 0x50:
|
||||
prim->u3 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v3 = primUVCoords[1];
|
||||
prim->u1 = primUVCoords[0];
|
||||
prim->v1 = primUVCoords[1];
|
||||
prim->u2 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v2 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u0 = primUVCoords[0];
|
||||
prim->v0 = primUVCoords[1] + primUVCoords[3];
|
||||
break;
|
||||
case 0x60:
|
||||
prim->u3 = primUVCoords[0];
|
||||
prim->v3 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u1 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v1 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u2 = primUVCoords[0];
|
||||
prim->v2 = primUVCoords[1];
|
||||
prim->u0 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v0 = primUVCoords[1];
|
||||
break;
|
||||
case 0x70:
|
||||
prim->u3 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v3 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u1 = primUVCoords[0];
|
||||
prim->v1 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u2 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v2 = primUVCoords[1];
|
||||
prim->u0 = primUVCoords[0];
|
||||
prim->v0 = primUVCoords[1];
|
||||
break;
|
||||
default:
|
||||
prim->u0 = primUVCoords[0];
|
||||
prim->v0 = primUVCoords[1];
|
||||
prim->u1 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v1 = primUVCoords[1];
|
||||
prim->u2 = primUVCoords[0];
|
||||
prim->v2 = primUVCoords[1] + primUVCoords[3];
|
||||
prim->u3 = primUVCoords[0] + primUVCoords[2];
|
||||
prim->v3 = primUVCoords[1] + primUVCoords[3];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (self->posY.i.hi < -0x40) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
if (self->posY.i.hi < 0) {
|
||||
self->velocityY -= FIX(0.5);
|
||||
}
|
||||
self->posY.val += self->velocityY;
|
||||
self->ext.giantcross.unk7C += 0x60;
|
||||
self->ext.giantcross.unk7E += 0x60;
|
||||
trans1.vx = -(rcos(self->ext.giantcross.unk7C) * 0x60) >> 0xC;
|
||||
trans1.vy = self->posY.i.hi - 0x80;
|
||||
trans1.vz = ((rsin(self->ext.giantcross.unk7C) * 0x60) >> 0xC) + 0x180;
|
||||
rot.vy = self->ext.giantcross.unk7E;
|
||||
rot.vz = 0x40;
|
||||
rot.vx = 0;
|
||||
|
||||
SetGeomOffset(self->posX.i.hi, 120);
|
||||
gte_SetGeomScreen(320);
|
||||
RotMatrix(&rot, &m);
|
||||
TransMatrix(&m, &trans1);
|
||||
gte_SetRotMatrix(&m);
|
||||
gte_SetTransMatrix(&m);
|
||||
gte_ldv0(&pos);
|
||||
gte_rtps();
|
||||
prim = &g_PrimBuf[self->primIndex];
|
||||
vectors_ptr = &D_8015607C;
|
||||
gte_stsxy2(&prim->x0);
|
||||
gte_stszotz(&z);
|
||||
self->hitboxOffX = prim->x0 - self->posX.i.hi;
|
||||
self->hitboxOffY = prim->y0 - self->posY.i.hi;
|
||||
for (i = 0; i < 46; i++, prim = prim->next, vectors_ptr += 4) {
|
||||
gte_ldv3(vectors_ptr[0], vectors_ptr[1], vectors_ptr[3]);
|
||||
gte_rtpt();
|
||||
temp_a3 = vectors_ptr[2];
|
||||
prim->type = 4;
|
||||
gte_nclip();
|
||||
prim->blendMode = 8;
|
||||
gte_stopz(&nclip);
|
||||
if (nclip < 0) {
|
||||
continue;
|
||||
}
|
||||
gte_stsxy3(&prim->x0, &prim->x1, &prim->x2);
|
||||
gte_ldv0(temp_a3);
|
||||
gte_rtps();
|
||||
prim->blendMode = 0;
|
||||
if (z < 16) {
|
||||
priority = 0x1F6;
|
||||
} else if (z >= 999) {
|
||||
priority = 0x10;
|
||||
} else {
|
||||
priority = 0x120;
|
||||
priority -= z;
|
||||
}
|
||||
prim->priority = priority;
|
||||
gte_stsxy(&prim->x3);
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,11 @@ extern s16 D_80155D1C[];
|
||||
extern s16 D_80155D30;
|
||||
extern s16 D_80155E68[];
|
||||
extern AnimationFrame* D_80155EA8;
|
||||
extern SVECTOR* D_8015607C[][4];
|
||||
extern u8 D_8015635C[][5];
|
||||
extern s8 D_80156904;
|
||||
extern SVECTOR D_80156C50;
|
||||
extern SVECTOR D_80156C58;
|
||||
extern s32 D_80174F74;
|
||||
extern s32 D_80174F78;
|
||||
extern s32 g_DebugWaitInfoTimer;
|
||||
|
Loading…
Reference in New Issue
Block a user