mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-06 14:20:11 +00:00
ovl_Efc_Erupc OK (#773)
* a few good dead Gfx_TwoTexScrolls * EfcErupc OK, mostly documented * review * remove fake match Co-authored-by: Fig02 <fig02srl@gmail.com>
This commit is contained in:
parent
4e81e4a388
commit
b7849976cf
15 changed files with 251 additions and 820 deletions
|
@ -9,12 +9,17 @@ void EfcErupc_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void EfcErupc_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
extern UNK_TYPE D_06001720;
|
||||
extern UNK_TYPE D_06002570;
|
||||
extern UNK_TYPE D_06002760;
|
||||
extern UNK_TYPE D_060027D8;
|
||||
void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx);
|
||||
void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalCtx);
|
||||
void EfcErupc_UpdateParticles(EfcErupc* this, GlobalContext* globalCtx);
|
||||
void EfcErupc_AddParticle(EfcErupcParticles* particles, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scaleFactor);
|
||||
void EfcErupc_InitParticles(EfcErupcParticles* particles);
|
||||
|
||||
extern Gfx D_06001720[];
|
||||
extern Gfx D_06002570[];
|
||||
extern Gfx D_06002760[];
|
||||
extern Gfx D_060027D8[];
|
||||
|
||||
/*
|
||||
const ActorInit Efc_Erupc_InitVars = {
|
||||
ACTOR_EFC_ERUPC,
|
||||
ACTORCAT_ITEMACTION,
|
||||
|
@ -26,23 +31,228 @@ const ActorInit Efc_Erupc_InitVars = {
|
|||
(ActorFunc)EfcErupc_Update,
|
||||
(ActorFunc)EfcErupc_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/func_8099CCB0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/EfcErupc_Init.s")
|
||||
void EfcErupc_SetupAction(EfcErupc* this, EfcErupcActionFunc actionFunc) {
|
||||
this->actionFunc = actionFunc;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/EfcErupc_Destroy.s")
|
||||
void EfcErupc_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EfcErupc* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/func_8099CD2C.s")
|
||||
EfcErupc_SetupAction(this, EfcErupc_UpdateAction);
|
||||
Actor_SetScale(&this->actor, 1.0f);
|
||||
EfcErupc_InitParticles(this->particles);
|
||||
this->unk14C = this->unk14E = this->unk150 = 0;
|
||||
this->unk152 = 5;
|
||||
this->unk154 = -100;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/EfcErupc_Update.s")
|
||||
void EfcErupc_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/EfcErupc_Draw.s")
|
||||
void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) {
|
||||
Vec3f pos;
|
||||
Vec3f vel;
|
||||
Vec3f accel;
|
||||
s32 i;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/func_8099D334.s")
|
||||
if (globalCtx->csCtx.state != 0) {
|
||||
if (globalCtx->csCtx.npcActions[1] != NULL) {
|
||||
if (globalCtx->csCtx.npcActions[1]->action == 2) {
|
||||
if (this->unk150 == 30) {
|
||||
func_800788CC(NA_SE_IT_EARTHQUAKE);
|
||||
}
|
||||
if (this->unk150 <= 64) {
|
||||
if (this->unk154 < 200) {
|
||||
this->unk154 += 10;
|
||||
}
|
||||
} else {
|
||||
if (this->unk154 > -100) {
|
||||
this->unk154 -= 10;
|
||||
}
|
||||
}
|
||||
this->unk150++;
|
||||
} else {
|
||||
if (this->unk154 > -100) {
|
||||
this->unk154 -= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (globalCtx->csCtx.state != 0) {
|
||||
if (globalCtx->csCtx.npcActions[2] != NULL) {
|
||||
switch (globalCtx->csCtx.npcActions[2]->action) {
|
||||
case 2:
|
||||
if (this->unk14E == 0) {
|
||||
func_800F3F3C(6);
|
||||
gSaveContext.eventChkInf[2] |= 0x8000;
|
||||
}
|
||||
this->unk14E++;
|
||||
break;
|
||||
case 3:
|
||||
this->unk14E = 30;
|
||||
}
|
||||
this->unk14C++;
|
||||
}
|
||||
}
|
||||
accel.z = 0.0f;
|
||||
accel.x = 0.0f;
|
||||
pos.y = this->actor.world.pos.y + 300.0f;
|
||||
for (i = 0; i < this->unk152; i++) {
|
||||
pos.x = Rand_CenteredFloat(100.0f) + this->actor.world.pos.x;
|
||||
pos.z = Rand_CenteredFloat(100.0f) + this->actor.world.pos.z;
|
||||
vel.x = Rand_CenteredFloat(100.0f);
|
||||
vel.y = Rand_ZeroFloat(100.0f);
|
||||
vel.z = Rand_CenteredFloat(100.0f);
|
||||
accel.y = this->unk154 * 0.1f;
|
||||
EfcErupc_AddParticle(this->particles, &pos, &vel, &accel, 80.0f);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/func_8099D52C.s")
|
||||
void EfcErupc_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EfcErupc* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/func_8099D650.s")
|
||||
this->actionFunc(this, globalCtx);
|
||||
EfcErupc_UpdateParticles(this, globalCtx);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Efc_Erupc/func_8099D71C.s")
|
||||
void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EfcErupc* this = THIS;
|
||||
u16 csAction;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_efc_erupc.c", 282);
|
||||
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk14C * 1, this->unk14E * -4, 32, 64, 1,
|
||||
this->unk14C * 4, this->unk14E * -20, 64, 64));
|
||||
|
||||
gSPSegment(
|
||||
POLY_XLU_DISP++, 0x09,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk150 * -4, 16, 128, 1, 0, this->unk150 * 12, 32, 32));
|
||||
|
||||
gSPSegment(
|
||||
POLY_XLU_DISP++, 0x0A,
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, this->unk150 * -4, 16, 128, 1, 0, this->unk150 * 12, 32, 32));
|
||||
|
||||
Matrix_Push();
|
||||
Matrix_Scale(0.8f, 0.8f, 0.8f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_efc_erupc.c", 321),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
if (globalCtx->csCtx.state != 0) {
|
||||
if ((globalCtx->csCtx.npcActions[1] != 0) && (globalCtx->csCtx.npcActions[1]->action == 2)) {
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_06002570);
|
||||
}
|
||||
}
|
||||
Matrix_Pop();
|
||||
Matrix_Scale(3.4f, 3.4f, 3.4f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_efc_erupc.c", 333),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
if (globalCtx->csCtx.state != 0) {
|
||||
CsCmdActorAction* csActorAction = globalCtx->csCtx.npcActions[2];
|
||||
if (csActorAction != 0) {
|
||||
csAction = csActorAction->action;
|
||||
if ((csAction == 2) || (csAction == 3)) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 200, 255);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 100, 0, 0, 255);
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_06001720);
|
||||
}
|
||||
}
|
||||
}
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_efc_erupc.c", 356);
|
||||
EfcErupc_DrawParticles(this->particles, globalCtx);
|
||||
}
|
||||
|
||||
void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalCtx) {
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
s16 i;
|
||||
s32 pad;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_efc_erupc.c", 368);
|
||||
for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) {
|
||||
if (particles->isActive) {
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_06002760);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, particles->color.r, particles->color.g, particles->color.b,
|
||||
particles->alpha);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 150, 0, 0, 0);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
Matrix_Translate(particles->pos.x, particles->pos.y, particles->pos.z, MTXMODE_NEW);
|
||||
func_800D1FD4(&globalCtx->mf_11DA0);
|
||||
Matrix_Scale(particles->scale, particles->scale, 1.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_efc_erupc.c", 393),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_060027D8);
|
||||
}
|
||||
}
|
||||
CLOSE_DISPS(gfxCtx, "../z_efc_erupc.c", 399);
|
||||
}
|
||||
|
||||
static Color_RGB8 D_8099D770[] = {
|
||||
{ 255, 128, 0 },
|
||||
{ 255, 0, 0 },
|
||||
{ 255, 255, 0 },
|
||||
{ 255, 0, 0 },
|
||||
};
|
||||
|
||||
void EfcErupc_UpdateParticles(EfcErupc* this, GlobalContext* globalCtx) {
|
||||
s16 i;
|
||||
s16 index;
|
||||
Color_RGB8 particleColors[] = {
|
||||
{ 255, 128, 0 },
|
||||
{ 255, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 100, 0, 0 },
|
||||
};
|
||||
Color_RGB8* color;
|
||||
EfcErupcParticles* cur = this->particles;
|
||||
|
||||
for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, cur++) {
|
||||
if (cur->isActive) {
|
||||
cur->pos.x += cur->vel.x;
|
||||
cur->pos.y += cur->vel.y;
|
||||
cur->pos.z += cur->vel.z;
|
||||
cur->vel.x += cur->accel.x;
|
||||
cur->vel.y += cur->accel.y;
|
||||
cur->vel.z += cur->accel.z;
|
||||
cur->animTimer += 1;
|
||||
index = cur->animTimer % 4;
|
||||
color = &particleColors[index];
|
||||
cur->color.r = color->r;
|
||||
cur->color.g = color->g;
|
||||
cur->color.b = color->b;
|
||||
cur->alpha -= 20;
|
||||
if (cur->alpha <= 0) {
|
||||
cur->alpha = 0;
|
||||
cur->isActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EfcErupc_AddParticle(EfcErupcParticles* particles, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scaleFactor) {
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) {
|
||||
if (!particles->isActive) {
|
||||
particles->isActive = true;
|
||||
particles->pos = *pos;
|
||||
particles->vel = *vel;
|
||||
particles->accel = *accel;
|
||||
particles->scale = scaleFactor / 1000.0f;
|
||||
particles->alpha = 255;
|
||||
particles->animTimer = (s16)Rand_ZeroFloat(10.0f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EfcErupc_InitParticles(EfcErupcParticles* particles) {
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) {
|
||||
particles->isActive = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,32 @@
|
|||
|
||||
struct EfcErupc;
|
||||
|
||||
typedef void (*EfcErupcActionFunc)(struct EfcErupc*, GlobalContext*);
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Vec3f pos;
|
||||
/* 0x0C */ Vec3f vel;
|
||||
/* 0x18 */ Vec3f accel;
|
||||
/* 0x24 */ u8 isActive;
|
||||
/* 0x25 */ u8 animTimer;
|
||||
/* 0x28 */ Color_RGB8 color;
|
||||
/* 0x2C */ s16 alpha;
|
||||
/* 0x30 */ char unk_2C[4];
|
||||
/* 0x34 */ f32 scale;
|
||||
/* 0x38 */ char unk_34[8];
|
||||
} EfcErupcParticles; // size 0x3C
|
||||
|
||||
#define EFC_ERUPC_NUM_PARTICLES 100
|
||||
|
||||
typedef struct EfcErupc {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x1780];
|
||||
/* 0x014C */ s16 unk14C;
|
||||
/* 0x014E */ s16 unk14E;
|
||||
/* 0x0150 */ s16 unk150;
|
||||
/* 0x0152 */ s16 unk152;
|
||||
/* 0x0154 */ s16 unk154;
|
||||
/* 0x0158 */ EfcErupcParticles particles[EFC_ERUPC_NUM_PARTICLES];
|
||||
/* 0x18C8 */ EfcErupcActionFunc actionFunc;
|
||||
} EfcErupc; // size = 0x18CC
|
||||
|
||||
extern const ActorInit Efc_Erupc_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue