mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-26 22:40:33 +00:00
Decompile no0
Ctulhu shockwave attack (#1912)
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (x86_64, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-macos (Debug, custom) (push) Blocked by required conditions
Build C code / build-macos (Debug, lle) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, lle) (push) Blocked by required conditions
Build C code / build-windows (Debug, custom) (push) Blocked by required conditions
Build C code / build-windows (Debug, lle) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, lle) (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
Some checks are pending
Format code / format (push) Waiting to run
Build C code / extract-assets (push) Waiting to run
Build C code / build-linux (x86_64, Debug, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, Debug, gcc, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, clang, lle) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, custom) (push) Blocked by required conditions
Build C code / build-linux (x86_64, RelWithDebInfo, gcc, lle) (push) Blocked by required conditions
Build C code / build-macos (Debug, custom) (push) Blocked by required conditions
Build C code / build-macos (Debug, lle) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-macos (RelWithDebInfo, lle) (push) Blocked by required conditions
Build C code / build-windows (Debug, custom) (push) Blocked by required conditions
Build C code / build-windows (Debug, lle) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, custom) (push) Blocked by required conditions
Build C code / build-windows (RelWithDebInfo, lle) (push) Blocked by required conditions
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build Debug Module tool / build (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
Planning on doing a cleanup pass over this whole enemy file next and importing data / documenting PSX: https://decomp.me/scratch/0jcyg PSP: https://decomp.me/scratch/n4vUq Thanks to Xeeynamo for help with the UV pointer array
This commit is contained in:
parent
d9bd6a6e4d
commit
9927a518b9
@ -2055,7 +2055,7 @@ typedef struct {
|
||||
/* 0x94 */ s32 : 32;
|
||||
/* 0x98 */ s32 : 32;
|
||||
/* 0x9C */ s32 y;
|
||||
/* 0xA0 */ s32 : 32;
|
||||
/* 0xA0 */ struct Primitive* shockwavePrim;
|
||||
/* 0xA4 */ struct Primitive* unkA4;
|
||||
} ET_Ctulhu;
|
||||
|
||||
|
@ -19,6 +19,8 @@ extern u8 D_us_8018245C[]; // anim_death
|
||||
extern u16 D_us_80180BEA[]; // clut
|
||||
extern u8 D_us_80182430[]; // anim fireball
|
||||
|
||||
extern s16* D_us_801C11B0[]; // uvs for shockwave
|
||||
|
||||
void EntityCtulhu(Entity* self) {
|
||||
RECT clipRect;
|
||||
DRAWENV drawEnv;
|
||||
@ -581,8 +583,219 @@ void EntityCtulhuFireball(Entity* self) {
|
||||
}
|
||||
}
|
||||
|
||||
// Ice shockwave attack
|
||||
INCLUDE_ASM("st/no0/nonmatchings/e_ctulhu", func_us_801DA6B4);
|
||||
void EntityCtulhuIceShockwave(Entity* self) {
|
||||
Primitive* prim;
|
||||
s16* ptr;
|
||||
s32 primIndex;
|
||||
s32 v2;
|
||||
|
||||
if (g_Timer & 1) {
|
||||
self->palette = g_EInitCtulhuIceShockwave[3];
|
||||
} else {
|
||||
self->palette = g_EInitCtulhuIceShockwave[3] + 1;
|
||||
}
|
||||
|
||||
switch (self->step) {
|
||||
case 0:
|
||||
InitializeEntity(g_EInitCtulhuIceShockwave);
|
||||
self->animCurFrame = 44;
|
||||
self->hitboxOffX = 7;
|
||||
self->drawMode = DRAW_TPAGE2 | DRAW_TPAGE;
|
||||
self->drawFlags = FLAG_DRAW_ROTY;
|
||||
self->rotY = 256;
|
||||
primIndex = g_api.AllocPrimitives(PRIM_GT4, 128);
|
||||
if (primIndex == -1) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
|
||||
self->flags |= FLAG_HAS_PRIMS;
|
||||
self->primIndex = primIndex;
|
||||
prim = &g_PrimBuf[primIndex];
|
||||
self->ext.prim = prim;
|
||||
while (prim != NULL) {
|
||||
prim->p3 = 0;
|
||||
prim->priority = self->zPriority - 1;
|
||||
prim->drawMode = DRAW_HIDE;
|
||||
prim = prim->next;
|
||||
}
|
||||
// Fallthrough
|
||||
case 1:
|
||||
if (self->facingLeft) {
|
||||
self->velocityX = FIX(4.0);
|
||||
} else {
|
||||
self->velocityX = FIX(-4.0);
|
||||
}
|
||||
MoveEntity();
|
||||
|
||||
if (g_Timer & 1) {
|
||||
self->rotY = 264;
|
||||
} else {
|
||||
self->rotY = 248;
|
||||
}
|
||||
|
||||
if (self->ext.ctulhu.shockwavePrim == NULL) {
|
||||
prim = self->ext.prim;
|
||||
prim = FindFirstUnkPrim(prim);
|
||||
self->ext.ctulhu.shockwavePrim = prim;
|
||||
|
||||
if (prim != NULL) {
|
||||
prim->p3 = 8;
|
||||
prim->tpage = 26;
|
||||
prim->clut = 0x1F5;
|
||||
prim->u0 = prim->u2 = 4;
|
||||
prim->u1 = prim->u3 = 28;
|
||||
prim->v0 = prim->v1 = prim->v2 = prim->v3 = 96;
|
||||
PGREY(prim, 0) = PGREY(prim, 1) = PGREY(prim, 2) =
|
||||
PGREY(prim, 3) = 128;
|
||||
prim->x0 = prim->x2 = prim->x1 = prim->x3 = self->posX.i.hi;
|
||||
prim->y0 = prim->y1 = prim->y2 = prim->y3 =
|
||||
self->posY.i.hi + 40;
|
||||
prim->priority = self->zPriority - 1;
|
||||
prim->drawMode =
|
||||
DRAW_TPAGE | DRAW_COLORS | DRAW_UNK02 | DRAW_TRANSP;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->ext.ctulhu.shockwavePrim != NULL) {
|
||||
prim = self->ext.ctulhu.shockwavePrim;
|
||||
prim->x1 = prim->x3 = self->posX.i.hi;
|
||||
prim->y0 = (prim->y1 -= 12);
|
||||
v2 = prim->v2;
|
||||
v2 += 4;
|
||||
if (v2 > 120) {
|
||||
v2 = 120;
|
||||
prim->p3 = 2;
|
||||
self->ext.ctulhu.shockwavePrim = NULL;
|
||||
}
|
||||
prim->v2 = prim->v3 = v2;
|
||||
}
|
||||
|
||||
if (!self->ext.ctulhu.timer) {
|
||||
self->ext.ctulhu.timer = 2;
|
||||
prim = self->ext.prim;
|
||||
prim = FindFirstUnkPrim(prim);
|
||||
if (prim != NULL) {
|
||||
prim->p3 = 4;
|
||||
prim->p1 = 0;
|
||||
prim->p2 = 0;
|
||||
prim->tpage = 23;
|
||||
prim->clut = 0x234;
|
||||
PGREY(prim, 0) = PGREY(prim, 1) = PGREY(prim, 2) =
|
||||
PGREY(prim, 3) = 96;
|
||||
prim->x0 = prim->x2 = self->posX.i.hi + 16;
|
||||
prim->x1 = prim->x3 = self->posX.i.hi - 16;
|
||||
prim->y0 = prim->y1 = self->posY.i.hi - 24;
|
||||
prim->y2 = prim->y3 = self->posY.i.hi + 48;
|
||||
prim->priority = self->zPriority;
|
||||
prim->drawMode = DRAW_TPAGE2 | DRAW_TPAGE | DRAW_COLORS |
|
||||
DRAW_UNK02 | DRAW_TRANSP;
|
||||
}
|
||||
} else {
|
||||
self->ext.ctulhu.timer -= 1;
|
||||
}
|
||||
|
||||
if (self->flags & FLAG_DEAD) {
|
||||
self->drawFlags |= FLAG_DRAW_UNK8;
|
||||
self->unk6C = 128;
|
||||
self->hitboxState = 0;
|
||||
self->step++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
MoveEntity();
|
||||
self->unk6C -= 8;
|
||||
self->rotY += 24;
|
||||
self->velocityX -= self->velocityX / 8;
|
||||
|
||||
if (g_Timer & 1) {
|
||||
self->animCurFrame = 0;
|
||||
} else {
|
||||
self->animCurFrame = 44;
|
||||
}
|
||||
|
||||
if (!self->unk6C) {
|
||||
DestroyEntity(self);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
prim = self->ext.prim;
|
||||
while (prim != NULL) {
|
||||
if (!(prim->drawMode & DRAW_HIDE)) {
|
||||
if (prim->p3 == 2) {
|
||||
PrimDecreaseBrightness(prim, 5);
|
||||
|
||||
if (g_Timer & 1) {
|
||||
prim->u0 = prim->u2 = 4;
|
||||
prim->u1 = prim->u3 = 28;
|
||||
} else {
|
||||
prim->u0 = prim->u2 = 28;
|
||||
prim->u1 = prim->u3 = 4;
|
||||
}
|
||||
|
||||
prim->y0 = (prim->y1 += 3);
|
||||
prim->v2 = (prim->v3 -= 1);
|
||||
|
||||
prim->x2 -= (F(self->velocityX).i.hi) >> 1;
|
||||
prim->x3 += (F(self->velocityX).i.hi) >> 1;
|
||||
if (prim->x0 != prim->x2) {
|
||||
prim->x0 = prim->x2;
|
||||
prim->x1 = prim->x3;
|
||||
} else {
|
||||
prim->x0 = prim->x2 + 4;
|
||||
prim->x1 = prim->x3 + 4;
|
||||
}
|
||||
|
||||
if (prim->y0 > prim->y2 || prim->v2 < prim->v0) {
|
||||
prim->p3 = 0;
|
||||
prim->drawMode = DRAW_HIDE;
|
||||
}
|
||||
}
|
||||
|
||||
if (prim->p3 == 4) {
|
||||
PrimDecreaseBrightness(prim, 4);
|
||||
if (prim->y2 - prim->y0 > 32) {
|
||||
prim->y0 = (prim->y1 += 2);
|
||||
}
|
||||
if (!prim->p2) {
|
||||
prim->p1++;
|
||||
if (prim->p1 > 13) {
|
||||
prim->p3 = 0;
|
||||
prim->drawMode = DRAW_HIDE;
|
||||
}
|
||||
#ifdef VERSION_PSP
|
||||
// Looks to be a bug fix on PSP
|
||||
// PSX can index outside size of D_us_801C11B0
|
||||
else {
|
||||
#endif
|
||||
ptr = D_us_801C11B0[prim->p1];
|
||||
ptr += 8;
|
||||
prim->u0 = prim->u2 = *ptr++;
|
||||
prim->v0 = prim->v1 = *ptr++;
|
||||
prim->u1 = prim->u3 = *ptr++;
|
||||
prim->v2 = prim->v3 = *ptr++;
|
||||
prim->p2 = 3;
|
||||
#ifdef VERSION_PSP
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
prim->p2 -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
prim = prim->next;
|
||||
}
|
||||
|
||||
if (self->velocityX > 0) {
|
||||
if (self->posX.i.hi > 384) {
|
||||
DestroyEntity(self);
|
||||
}
|
||||
} else if (self->posX.i.hi < -128) {
|
||||
DestroyEntity(self);
|
||||
}
|
||||
}
|
||||
|
||||
void EntityCtulhuDeath(Entity* self) {
|
||||
switch (self->step) {
|
||||
|
@ -69,7 +69,7 @@ void func_us_801D7DAC(Entity*);
|
||||
void func_us_801C2B24(Entity*);
|
||||
void EntityCtulhu(Entity*);
|
||||
void EntityCtulhuFireball(Entity*);
|
||||
void func_us_801DA6B4(Entity*);
|
||||
void EntityCtulhuIceShockwave(Entity*);
|
||||
void EntityCtulhuDeath(Entity*);
|
||||
void EntityAxeKnight(Entity*);
|
||||
void EntityAxeKnightThrowingAxe(Entity*);
|
||||
@ -152,7 +152,7 @@ PfnEntityUpdate OVL_EXPORT(EntityUpdates)[] = {
|
||||
func_us_801C2B24,
|
||||
EntityCtulhu,
|
||||
EntityCtulhuFireball,
|
||||
func_us_801DA6B4,
|
||||
EntityCtulhuIceShockwave,
|
||||
EntityCtulhuDeath,
|
||||
EntityAxeKnight,
|
||||
EntityAxeKnightThrowingAxe,
|
||||
@ -200,7 +200,7 @@ 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 g_EInitCtulhuFireball = {ANIMSET_OVL(0x0E), 0x00, 0x50, 0x238, 0x0EA};
|
||||
EInit D_us_80180BF0 = {ANIMSET_OVL(0x0E), 0x2C, 0x50, 0x238, 0x0EB};
|
||||
EInit g_EInitCtulhuIceShockwave = {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};
|
||||
EInit g_EInitOuijaTable = {ANIMSET_OVL(0x02), 0x00, 0x4B, 0x241, 0x0C1};
|
||||
|
@ -50,6 +50,8 @@ typedef enum EntityIDs {
|
||||
/* 0x4F */ E_SKELETON_PIECES,
|
||||
} EntityIDs;
|
||||
|
||||
extern Primitive* FindFirstUnkPrim(Primitive* poly);
|
||||
|
||||
#define E_PUFF_OPAQUE_PALETTE_OFFSET 0x2C0
|
||||
|
||||
extern s16 g_SineTable[];
|
||||
@ -87,6 +89,7 @@ extern EInit g_EInitSkelerangBoomerang;
|
||||
// Ctulhu
|
||||
extern EInit g_EInitCtulhu;
|
||||
extern EInit g_EInitCtulhuFireball;
|
||||
extern EInit g_EInitCtulhuIceShockwave;
|
||||
|
||||
// Clock room
|
||||
extern EInit g_Statues;
|
||||
|
Loading…
Reference in New Issue
Block a user