Decompile no0 Ctulhu fireball attack entity (#1910)

`func_us_801DA488` / `EntityCtulhuFireball`

PSX: https://decomp.me/scratch/aCOVv
PSP: https://decomp.me/scratch/QYpzQ
This commit is contained in:
Josh Schreuder 2024-11-16 15:00:29 +11:00 committed by GitHub
parent d646cd1a17
commit 00399edda7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 70 additions and 5 deletions

View File

@ -16,6 +16,9 @@ extern u8 D_us_8018243C[];
extern u16 D_us_80182454[];
extern u8 D_us_8018245C[]; // anim_death
extern u16 D_us_80180BEA[]; // clut
extern u8 D_us_80182430[]; // anim fireball
void EntityCtulhu(Entity* self) {
RECT clipRect;
DRAWENV drawEnv;
@ -514,8 +517,69 @@ void EntityCtulhu(Entity* self) {
}
}
// Shot fireball
INCLUDE_ASM("st/no0/nonmatchings/e_ctulhu", func_us_801DA488);
void EntityCtulhuFireball(Entity* self) {
Entity* newEntity;
Primitive* prim;
s32 primIndex;
s16 rotZ;
if (!self->step) {
InitializeEntity(g_EInitCtulhuFireball);
self->drawFlags = FLAG_DRAW_ROTZ;
rotZ = self->rotZ;
if (self->facingLeft) {
rotZ = -rotZ;
} else {
rotZ = rotZ + 0x800;
}
self->velocityX = rcos(rotZ) * 48;
self->velocityY = rsin(rotZ) * 48;
primIndex = g_api.AllocPrimitives(PRIM_GT4, 1);
if (primIndex == -1) {
DestroyEntity(self);
return;
}
self->flags |= FLAG_HAS_PRIMS;
self->primIndex = primIndex;
prim = &g_PrimBuf[primIndex];
self->ext.prim = prim;
prim->tpage = 20;
prim->clut = D_us_80180BEA[0] + 1;
prim->u0 = prim->u2 = 224;
prim->u1 = prim->u3 = 255;
prim->v0 = prim->v1 = 48;
prim->v2 = prim->v3 = 79;
prim->priority = self->zPriority - 1;
prim->drawMode =
DRAW_UNK_40 | DRAW_TPAGE2 | DRAW_TPAGE | DRAW_UNK02 | DRAW_TRANSP;
}
AnimateEntity(D_us_80182430, self);
MoveEntity();
prim = self->ext.prim;
prim->x0 = prim->x2 = self->posX.i.hi - 24;
prim->x1 = prim->x3 = self->posX.i.hi + 24;
prim->y0 = prim->y1 = self->posY.i.hi - 24;
prim->y2 = prim->y3 = self->posY.i.hi + 24;
if (g_Timer & 1) {
prim->drawMode =
DRAW_UNK_40 | DRAW_TPAGE2 | DRAW_TPAGE | DRAW_UNK02 | DRAW_TRANSP;
} else {
prim->drawMode = DRAW_HIDE;
}
if (self->flags & FLAG_DEAD) {
newEntity = AllocEntity(&g_Entities[224], &g_Entities[256]);
if (newEntity != NULL) {
CreateEntityFromEntity(2, self, newEntity);
newEntity->params = 2;
}
DestroyEntity(self);
}
}
// Ice shockwave attack
INCLUDE_ASM("st/no0/nonmatchings/e_ctulhu", func_us_801DA6B4);

View File

@ -68,7 +68,7 @@ void func_us_801D91C4(Entity*);
void func_us_801D7DAC(Entity*);
void func_us_801C2B24(Entity*);
void EntityCtulhu(Entity*);
void func_us_801DA488(Entity*);
void EntityCtulhuFireball(Entity*);
void func_us_801DA6B4(Entity*);
void EntityCtulhuDeath(Entity*);
void EntityAxeKnight(Entity*);
@ -151,7 +151,7 @@ PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = {
func_us_801D7DAC,
func_us_801C2B24,
EntityCtulhu,
func_us_801DA488,
EntityCtulhuFireball,
func_us_801DA6B4,
EntityCtulhuDeath,
EntityAxeKnight,
@ -199,7 +199,7 @@ EInit g_EInitSlinger = {ANIMSET_OVL(0x0A), 0x01, 0x49, 0x203, 0x0B2};
EInit g_EInitSlingerPieces = {ANIMSET_OVL(0x0A), 0x00, 0x49, 0x203, 0x002};
EInit g_EInitSlingerRib = {ANIMSET_OVL(0x0A), 0x16, 0x49, 0x203, 0x0B3};
EInit g_EInitCtulhu = {ANIMSET_OVL(0x0E), 0x00, 0x50, 0x238, 0x0E9};
EInit D_us_80180BE4 = {ANIMSET_OVL(0x0E), 0x00, 0x50, 0x238, 0x0EA};
EInit g_EInitCtulhuFireball = {ANIMSET_OVL(0x0E), 0x00, 0x50, 0x238, 0x0EA};
EInit D_us_80180BF0 = {ANIMSET_OVL(0x0E), 0x2C, 0x50, 0x238, 0x0EB};
EInit g_EInitAxeKnight = {ANIMSET_OVL(0x07), 0x01, 0x48, 0x23F, 0x0F6};
EInit g_EInitAxeKnightAxe = {ANIMSET_OVL(0x07), 0x2F, 0x48, 0x23D, 0x18F};

View File

@ -86,6 +86,7 @@ extern EInit g_EInitSkelerangBoomerang;
// Ctulhu
extern EInit g_EInitCtulhu;
extern EInit g_EInitCtulhuFireball;
// Clock room
extern EInit g_Statues;