1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 14:20:11 +00:00

Bomb Related Effect Overlays (#283)

* fix colliderinit typo

* dead sound done

* deadsound documentation

* blast done

* progress

* spk init

* progress

* spark done

* ss bomb ok

* bomb done

* cleanup

* progress

* progress

* almost done with bomb2

* clean up gossip stone

* more

* cleanup and format

* remove unused asm file

* nonmatching reloc

* done i think

* mistakes

* fix headers

* idk how that got in here

* match bomb2

* asm file

* pr review
This commit is contained in:
fig02 2020-07-28 15:49:00 -04:00 committed by GitHub
parent c76c584006
commit 19c990b852
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
82 changed files with 822 additions and 2416 deletions

View file

@ -1,40 +1,95 @@
/*
* File: z_eff_ss_blast.c
* Overlay: ovl_Effect_Ss_Blast
* Description:
* Description: Shockwave Effect
*/
#include "z_eff_ss_blast.h"
typedef enum {
/* 0x00 */ SS_BLAST_0,
/* 0x01 */ SS_BLAST_1,
/* 0x02 */ SS_BLAST_2,
/* 0x03 */ SS_BLAST_3,
/* 0x04 */ SS_BLAST_4,
/* 0x05 */ SS_BLAST_5,
/* 0x06 */ SS_BLAST_6,
/* 0x07 */ SS_BLAST_7,
/* 0x08 */ SS_BLAST_8,
/* 0x09 */ SS_BLAST_9,
/* 0x0A */ SS_BLAST_A,
/* 0x0B */ SS_BLAST_B,
/* 0x0C */ SS_BLAST_C,
/* 0x00 */ SS_BLAST_ENV_R,
/* 0x01 */ SS_BLAST_ENV_G,
/* 0x02 */ SS_BLAST_ENV_B,
/* 0x03 */ SS_BLAST_ENV_A,
/* 0x04 */ SS_BLAST_PRIM_R,
/* 0x05 */ SS_BLAST_PRIM_G,
/* 0x06 */ SS_BLAST_PRIM_B,
/* 0x07 */ SS_BLAST_PRIM_A,
/* 0x08 */ SS_BLAST_ALPHA_STEP,
/* 0x09 */ SS_BLAST_RADIUS,
/* 0x0A */ SS_BLAST_RADIUS_STEP,
/* 0x0B */ SS_BLAST_RADIUS_STEP_DECR,
} EffectSsBlastRegs;
u32 EffectSsBlast_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsBlast_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
/*
EffectSsInit Effect_Ss_Blast_InitVars = {
EFFECT_SS_BLAST,
EffectSsBlast_Init,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Blast/EffectSsBlast_Init.s")
extern Gfx D_0401A0B0[];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Blast/func_8099EF08.s")
u32 EffectSsBlast_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
EffectSsBlastParams* initParams = (EffectSsBlastParams*)initParamsx;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Blast/func_8099F0AC.s")
this->pos = initParams->pos;
this->pos.y += 5.0f;
this->velocity = initParams->velocity;
this->accel = initParams->accel;
this->displayList = SEGMENTED_TO_VIRTUAL(D_0401A0B0);
this->life = initParams->life;
this->draw = EffectSsBlast_Draw;
this->update = EffectSsBlast_Update;
this->regs[SS_BLAST_ENV_R] = initParams->envColor.r;
this->regs[SS_BLAST_ENV_G] = initParams->envColor.g;
this->regs[SS_BLAST_ENV_B] = initParams->envColor.b;
this->regs[SS_BLAST_ENV_A] = initParams->envColor.a;
this->regs[SS_BLAST_PRIM_R] = initParams->primColor.r;
this->regs[SS_BLAST_PRIM_G] = initParams->primColor.g;
this->regs[SS_BLAST_PRIM_B] = initParams->primColor.b;
this->regs[SS_BLAST_PRIM_A] = initParams->primColor.a;
this->regs[SS_BLAST_ALPHA_STEP] = initParams->envColor.a / initParams->life;
this->regs[SS_BLAST_RADIUS] = initParams->radius;
this->regs[SS_BLAST_RADIUS_STEP] = initParams->radiusStep;
this->regs[SS_BLAST_RADIUS_STEP_DECR] = initParams->radiusStepDecr;
return 1;
}
void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
s32 pad;
MtxF mtx;
s32 pad1;
f32 scale;
GraphicsContext* gfxCtx;
Gfx* dispRefs[4];
gfxCtx = globalCtx->state.gfxCtx;
Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_blast.c", 170);
scale = this->regs[SS_BLAST_RADIUS] * 0.0025f;
func_80093D84(globalCtx->state.gfxCtx);
gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_BLAST_PRIM_R], this->regs[SS_BLAST_PRIM_G],
this->regs[SS_BLAST_PRIM_B], this->regs[SS_BLAST_PRIM_A]);
func_800BFCB8(globalCtx, &mtx, &this->pos);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_BLAST_ENV_R], this->regs[SS_BLAST_ENV_G],
this->regs[SS_BLAST_ENV_B], this->regs[SS_BLAST_ENV_A]);
Matrix_Put(&mtx);
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(gfxCtx, "../z_eff_ss_blast.c", 199),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList);
Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_blast.c", 204);
}
void EffectSsBlast_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
Math_ApproxS(&this->regs[SS_BLAST_ENV_A], 0, this->regs[SS_BLAST_ALPHA_STEP]);
this->regs[SS_BLAST_RADIUS] += this->regs[SS_BLAST_RADIUS_STEP];
if (this->regs[SS_BLAST_RADIUS_STEP] != 0) {
this->regs[SS_BLAST_RADIUS_STEP] -= this->regs[SS_BLAST_RADIUS_STEP_DECR];
}
}

View file

@ -8,6 +8,12 @@ typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
/* 0x18 */ Vec3f accel;
} EffectSsBlastInitParams; // size = 0x
/* 0x24 */ Color_RGBA8 envColor;
/* 0x28 */ Color_RGBA8 primColor;
/* 0x2C */ s16 radius;
/* 0x2E */ s16 radiusStep;
/* 0x30 */ s16 radiusStepDecr;
/* 0x32 */ s16 life;
} EffectSsBlastParams; // size = 0x34
#endif

View file

@ -1,40 +1,102 @@
/*
* File: z_eff_ss_bomb.c
* Overlay: ovl_Effect_Ss_Bomb
* Description:
* Description: Bomb Blast. Unused in the orignal game.
*/
#include "z_eff_ss_bomb.h"
typedef enum {
/* 0x00 */ SS_BOMB_0,
/* 0x01 */ SS_BOMB_1,
/* 0x02 */ SS_BOMB_2,
/* 0x03 */ SS_BOMB_3,
/* 0x04 */ SS_BOMB_4,
/* 0x05 */ SS_BOMB_5,
/* 0x06 */ SS_BOMB_6,
/* 0x07 */ SS_BOMB_7,
/* 0x08 */ SS_BOMB_8,
/* 0x09 */ SS_BOMB_9,
/* 0x0A */ SS_BOMB_A,
/* 0x0B */ SS_BOMB_B,
/* 0x0C */ SS_BOMB_C,
/* 0x00 */ SS_BOMB_SCALE,
/* 0x01 */ SS_BOMB_TEX_IDX,
} EffectSsBombRegs;
u32 EffectSsBomb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsBomb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
/*
EffectSsInit Effect_Ss_Bomb_InitVars = {
EFFECT_SS_BOMB,
EffectSsBomb_Init,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb/EffectSsBomb_Init.s")
static UNK_PTR D_8099F588[] = {
0x04007F80,
0x04008780,
0x04008F80,
0x04009780,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb/func_8099F274.s")
extern Gfx D_0400BF80[];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb/func_8099F4D8.s")
u32 EffectSsBomb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
EffectSsBombInitParams* initParams = (EffectSsBombInitParams*)initParamsx;
Math_Vec3f_Copy(&this->pos, &initParams->pos);
Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
Math_Vec3f_Copy(&this->accel, &initParams->accel);
this->displayList = SEGMENTED_TO_VIRTUAL(D_0400BF80);
this->life = 20;
this->draw = EffectSsBomb_Draw;
this->update = EffectSsBomb_Update;
this->regs[SS_BOMB_SCALE] = 100;
this->regs[SS_BOMB_TEX_IDX] = 0;
return 1;
}
void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
s32 pad;
MtxF sp12C;
MtxF spEC;
MtxF spAC;
MtxF sp6C;
Mtx* mtx;
s32 pad2;
f32 scale;
s16 color;
GraphicsContext* gfxCtx;
Gfx* dispRefs[4];
if (1) {}
gfxCtx = globalCtx->state.gfxCtx;
Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb.c", 168);
scale = this->regs[SS_BOMB_SCALE] / 100.0f;
func_800A7A24(&sp12C, this->pos.x, this->pos.y, this->pos.z);
func_800A76A4(&spEC, scale, scale, 1.0f);
func_800A6FA0(&sp12C, &globalCtx->mf_11DA0, &sp6C);
func_800A6FA0(&sp6C, &spEC, &spAC);
gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtx = func_800A7E70(gfxCtx, &spAC);
if (mtx != NULL) {
gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8099F588[this->regs[SS_BOMB_TEX_IDX]]));
gDPPipeSync(gfxCtx->polyXlu.p++);
func_80094C50(gfxCtx);
color = this->life * 12.75f;
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, color, color, color, color);
gDPPipeSync(gfxCtx->polyXlu.p++);
gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList);
gDPPipeSync(gfxCtx->polyXlu.p++);
}
Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb.c", 214);
}
void EffectSsBomb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
if ((this->life < 21) && (this->life >= 17)) {
this->regs[SS_BOMB_TEX_IDX] = (20 - this->life);
} else {
this->regs[SS_BOMB_SCALE] += 0;
this->regs[SS_BOMB_TEX_IDX] = 3;
}
this->accel.x = ((Math_Rand_ZeroOne() * 0.4f) - 0.2f);
this->accel.z = ((Math_Rand_ZeroOne() * 0.4f) - 0.2f);
}

View file

@ -8,6 +8,6 @@ typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
/* 0x18 */ Vec3f accel;
} EffectSsBombInitParams; // size = 0x
} EffectSsBombInitParams; // size = 0x24
#endif

View file

@ -1,42 +1,207 @@
/*
* File: z_eff_ss_bomb2.c
* Overlay: ovl_Effect_Ss_Bomb2
* Description:
* Description: Bomb Blast
*/
#include "z_eff_ss_bomb2.h"
typedef enum {
/* 0x00 */ SS_BOMB2_0,
/* 0x01 */ SS_BOMB2_1,
/* 0x02 */ SS_BOMB2_2,
/* 0x03 */ SS_BOMB2_3,
/* 0x04 */ SS_BOMB2_4,
/* 0x05 */ SS_BOMB2_5,
/* 0x06 */ SS_BOMB2_6,
/* 0x07 */ SS_BOMB2_7,
/* 0x08 */ SS_BOMB2_8,
/* 0x09 */ SS_BOMB2_9,
/* 0x0A */ SS_BOMB2_A,
/* 0x0B */ SS_BOMB2_B,
/* 0x0C */ SS_BOMB2_C,
/* 0x00 */ SS_BOMB2_SCALE,
/* 0x01 */ SS_BOMB2_TEX_IDX,
/* 0x02 */ SS_BOMB2_PRIM_R,
/* 0x03 */ SS_BOMB2_PRIM_G,
/* 0x04 */ SS_BOMB2_PRIM_B,
/* 0x05 */ SS_BOMB2_PRIM_A,
/* 0x06 */ SS_BOMB2_ENV_R,
/* 0x07 */ SS_BOMB2_ENV_G,
/* 0x08 */ SS_BOMB2_ENV_B,
/* 0x09 */ SS_BOMB2_SCALE_STEP,
/* 0x0A */ SS_BOMB2_A
} EffectSsBomb2Regs;
u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
void EffectSsBomb2_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsBomb2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
/*
EffectSsInit Effect_Ss_Bomb2_InitVars = {
EFFECT_SS_BOMB2,
EffectSsBomb2_Init,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb2/EffectSsBomb2_Init.s")
static void* sDrawFuncs[] = {
EffectSsBomb2_DrawFade,
EffectSsBomb2_DrawLayered,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb2/func_8099F748.s")
static UNK_PTR D_8099FEE0[] = {
0x04007F80, 0x04008780, 0x04008F80, 0x04009780, 0x04009F80, 0x0400A780, 0x0400AF80, 0x0400B780,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb2/func_8099F960.s")
static UNK_PTR D_8099FF00[] = {
0x04007F80, 0x04008780, 0x04008F80, 0x04009780, 0x04009F80, 0x0400A780, 0x0400AF80, 0x0400B780,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Bomb2/func_8099FCCC.s")
extern Gfx D_0400BF80[];
extern Gfx D_0400BFE8[];
extern Gfx D_0400C040[];
u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
EffectSsBomb2InitParams* initParams = (EffectSsBomb2InitParams*)initParamsx;
Math_Vec3f_Copy(&this->pos, &initParams->pos);
Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
Math_Vec3f_Copy(&this->accel, &initParams->accel);
this->displayList = SEGMENTED_TO_VIRTUAL(&D_0400BF80);
this->life = 24;
this->update = EffectSsBomb2_Update;
this->draw = sDrawFuncs[initParams->drawMode];
this->regs[SS_BOMB2_SCALE] = initParams->scale;
this->regs[SS_BOMB2_SCALE_STEP] = initParams->scaleStep;
this->regs[SS_BOMB2_PRIM_R] = 255;
this->regs[SS_BOMB2_PRIM_G] = 255;
this->regs[SS_BOMB2_PRIM_B] = 255;
this->regs[SS_BOMB2_PRIM_A] = 255;
this->regs[SS_BOMB2_ENV_R] = 0;
this->regs[SS_BOMB2_ENV_G] = 0;
this->regs[SS_BOMB2_ENV_B] = 200;
return 1;
}
// unused in the original game. looks like EffectSsBomb but with color
void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this) {
s32 pad;
MtxF sp11C;
MtxF spDC;
MtxF sp9C;
MtxF sp5C;
Mtx* mtx;
s32 pad2;
f32 scale;
GraphicsContext* gfxCtx;
Gfx* dispRefs[4];
gfxCtx = globalCtx->state.gfxCtx;
Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb2.c", 298);
scale = this->regs[SS_BOMB2_SCALE] * 0.01f;
func_800A7A24(&sp11C, this->pos.x, this->pos.y, this->pos.z);
func_800A76A4(&spDC, scale, scale, 1.0f);
func_800A6FA0(&sp11C, &globalCtx->mf_11DA0, &sp5C);
func_800A6FA0(&sp5C, &spDC, &sp9C);
mtx = func_800A7E70(gfxCtx, &sp9C);
if (mtx != NULL) {
gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
func_80094BC4(gfxCtx);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_BOMB2_PRIM_R], this->regs[SS_BOMB2_PRIM_G],
this->regs[SS_BOMB2_PRIM_B], this->regs[SS_BOMB2_PRIM_A]);
gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_BOMB2_ENV_R], this->regs[SS_BOMB2_ENV_G],
this->regs[SS_BOMB2_ENV_B], 0);
gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8099FEE0[this->regs[SS_BOMB2_TEX_IDX]]));
gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList);
if (1) {}
if (1) {}
}
Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb2.c", 345);
}
void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* this) {
s32 pad1;
MtxF sp1B4;
MtxF sp174;
MtxF sp134;
MtxF spF4;
MtxF spB4;
Mtx* mtx2;
Mtx* mtx;
s32 pad;
s32 pad2;
s32 pad3;
f32 scale;
f32 temp_f24;
f32 mtxScale = 0.925f;
s32 i;
GraphicsContext* gfxCtx;
Gfx* dispRefs[4];
gfxCtx = globalCtx->state.gfxCtx;
Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb2.c", 386);
temp_f24 = this->regs[SS_BOMB2_A];
scale = this->regs[SS_BOMB2_SCALE] * 0.01f;
func_800A7A24(&sp1B4, this->pos.x, this->pos.y, this->pos.z);
func_800A76A4(&sp174, scale, scale, 1.0f);
func_800A6FA0(&sp1B4, &globalCtx->mf_11DA0, &spF4);
func_800A6FA0(&spF4, &sp174, &sp134);
mtx = func_800A7E70(gfxCtx, &sp134);
if (mtx != NULL) {
gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtx2 = func_800A7E70(gfxCtx, &sp134);
if (mtx2 != NULL) {
func_80094BC4(gfxCtx);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_BOMB2_PRIM_R], this->regs[SS_BOMB2_PRIM_G],
this->regs[SS_BOMB2_PRIM_B], this->regs[SS_BOMB2_PRIM_A]);
gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_BOMB2_ENV_R], this->regs[SS_BOMB2_ENV_G],
this->regs[SS_BOMB2_ENV_B], 0);
gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8099FF00[this->regs[SS_BOMB2_TEX_IDX]]));
gSPDisplayList(gfxCtx->polyXlu.p++, D_0400BFE8);
gSPDisplayList(gfxCtx->polyXlu.p++, D_0400C040);
Matrix_MtxToMtxF(mtx2, &spB4);
Matrix_Put(&spB4);
for (i = 1; i >= 0; i--) {
Matrix_Translate(0.0f, 0.0f, temp_f24, MTXMODE_APPLY);
Matrix_RotateZ((this->life * 0.02f) + 180.0f, MTXMODE_APPLY);
Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_ss_bomb2.c", 448),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyXlu.p++, D_0400C040);
mtxScale -= 0.15f;
}
}
if (1) {}
if (1) {}
}
Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb2.c", 456);
}
void EffectSsBomb2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
s32 divisor;
this->regs[SS_BOMB2_TEX_IDX] = (23 - this->life) / 3;
this->regs[SS_BOMB2_SCALE] += this->regs[SS_BOMB2_SCALE_STEP];
if (this->regs[SS_BOMB2_SCALE_STEP] == 30) {
this->regs[SS_BOMB2_A] += 4.0f;
} else {
this->regs[SS_BOMB2_A] += 2.0f;
}
if ((this->life < 23) && (this->life >= 14)) {
divisor = this->life - 13;
this->regs[SS_BOMB2_PRIM_R] = func_80027DD4(this->regs[SS_BOMB2_PRIM_R], 255, divisor);
this->regs[SS_BOMB2_PRIM_G] = func_80027DD4(this->regs[SS_BOMB2_PRIM_G], 255, divisor);
this->regs[SS_BOMB2_PRIM_B] = func_80027DD4(this->regs[SS_BOMB2_PRIM_B], 150, divisor);
this->regs[SS_BOMB2_PRIM_A] = func_80027DD4(this->regs[SS_BOMB2_PRIM_A], 255, divisor);
this->regs[SS_BOMB2_ENV_R] = func_80027DD4(this->regs[SS_BOMB2_ENV_R], 150, divisor);
this->regs[SS_BOMB2_ENV_G] = func_80027DD4(this->regs[SS_BOMB2_ENV_G], 0, divisor);
this->regs[SS_BOMB2_ENV_B] = func_80027DD4(this->regs[SS_BOMB2_ENV_B], 0, divisor);
} else if ((this->life < 14) && (this->life >= 0)) {
divisor = this->life + 1;
this->regs[SS_BOMB2_PRIM_R] = func_80027DD4(this->regs[SS_BOMB2_PRIM_R], 50, divisor);
this->regs[SS_BOMB2_PRIM_G] = func_80027DD4(this->regs[SS_BOMB2_PRIM_G], 50, divisor);
this->regs[SS_BOMB2_PRIM_B] = func_80027DD4(this->regs[SS_BOMB2_PRIM_B], 50, divisor);
this->regs[SS_BOMB2_PRIM_A] = func_80027DD4(this->regs[SS_BOMB2_PRIM_A], 150, divisor);
this->regs[SS_BOMB2_ENV_R] = func_80027DD4(this->regs[SS_BOMB2_ENV_R], 10, divisor);
this->regs[SS_BOMB2_ENV_G] = func_80027DD4(this->regs[SS_BOMB2_ENV_G], 10, divisor);
this->regs[SS_BOMB2_ENV_B] = func_80027DD4(this->regs[SS_BOMB2_ENV_B], 10, divisor);
}
}

View file

@ -8,6 +8,9 @@ typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
/* 0x18 */ Vec3f accel;
} EffectSsBomb2InitParams; // size = 0x
/* 0x24 */ s16 scale;
/* 0x26 */ s16 scaleStep;
/* 0x28 */ u8 drawMode;
} EffectSsBomb2InitParams; // size = 0x30
#endif

View file

@ -1,38 +1,55 @@
/*
* File: z_eff_ss_dead_sound.c
* Overlay: ovl_Effect_Ss_Dead_Sound
* Description:
* Description: Plays a sound effect.
*
* If repeat mode is on, the sound is replayed every update for the duration of life.
* Repeat mode is unused in the original game.
*/
#include "z_eff_ss_dead_sound.h"
typedef enum {
/* 0x00 */ SS_DEAD_SOUND_0,
/* 0x01 */ SS_DEAD_SOUND_1,
/* 0x02 */ SS_DEAD_SOUND_2,
/* 0x03 */ SS_DEAD_SOUND_3,
/* 0x04 */ SS_DEAD_SOUND_4,
/* 0x05 */ SS_DEAD_SOUND_5,
/* 0x06 */ SS_DEAD_SOUND_6,
/* 0x07 */ SS_DEAD_SOUND_7,
/* 0x08 */ SS_DEAD_SOUND_8,
/* 0x09 */ SS_DEAD_SOUND_9,
/* 0x0A */ SS_DEAD_SOUND_A,
/* 0x0B */ SS_DEAD_SOUND_B,
/* 0x0C */ SS_DEAD_SOUND_C,
} EffectSsDead_SoundRegs;
/* 0x0A */ SS_DEADSOUND_SFX_ID = 10,
/* 0x0B */ SS_DEADSOUND_REPEAT_MODE,
} EffectSsDeadSoundRegs;
#define REPEAT_MODE_OFF 1
#define REPEAT_MODE_ON 2
u32 EffectSsDeadSound_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
void EffectSsDeadSound_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsDeadSound_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
/*
EffectSsInit Effect_Ss_Dead_Sound_InitVars = {
EFFECT_SS_DEAD_SOUND,
EffectSsDeadSound_Init,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Sound/EffectSsDeadSound_Init.s")
u32 EffectSsDeadSound_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
EffectSsDeadSoundInitParams* initParams = (EffectSsDeadSoundInitParams*)initParamsx;
this->pos = initParams->pos;
this->velocity = initParams->velocity;
this->accel = initParams->accel;
this->flags = 2;
this->life = initParams->life;
this->draw = NULL;
this->update = EffectSsDeadSound_Update;
this->regs[SS_DEADSOUND_REPEAT_MODE] = initParams->repeatMode;
this->regs[SS_DEADSOUND_SFX_ID] = initParams->sfxId;
// "constructor 3"
osSyncPrintf("コンストラクター3\n");
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_Dead_Sound/func_809A1BD8.s")
void EffectSsDeadSound_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
switch (this->regs[SS_DEADSOUND_REPEAT_MODE]) {
case REPEAT_MODE_OFF:
this->regs[SS_DEADSOUND_REPEAT_MODE]--;
break;
case REPEAT_MODE_ON:
break;
default:
return;
}
Audio_PlaySoundGeneral(this->regs[SS_DEADSOUND_SFX_ID], &this->pos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}

View file

@ -8,6 +8,11 @@ typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
/* 0x18 */ Vec3f accel;
} EffectSsDeadSoundInitParams; // size = 0x
/* 0x24 */ u16 sfxId;
/* 0x26 */ s16 lowerPriority;
/* 0x28 */ s16 repeatMode;
/* 0x26 */ s16 unused2;
/* 0x2C */ s32 life;
} EffectSsDeadSoundInitParams; // size = 0x30
#endif

View file

@ -34,9 +34,8 @@ EffectSsInit Effect_Ss_Dust_InitVars = {
static void* sUpdateFuncs[] = { EffectSsDust_Update, EffectSsBlast_UpdateFire };
UNK_PTR D_809A2A50[] = {
0x04051DB0, 0x040521B0, 0x040525B0, 0x040529B0, 0x04052DB0, 0x040531B0, 0x040535B0, 0x040539B0
};
static UNK_PTR D_809A2A50[] = { 0x04051DB0, 0x040521B0, 0x040525B0, 0x040529B0,
0x04052DB0, 0x040531B0, 0x040535B0, 0x040539B0 };
extern Gfx D_04010050[];
@ -47,7 +46,7 @@ u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void*
Math_Vec3f_Copy(&this->pos, &initParams->pos);
Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
Math_Vec3f_Copy(&this->accel, &initParams->accel);
this->unk_38 = SEGMENTED_TO_VIRTUAL(&D_04010050);
this->displayList = SEGMENTED_TO_VIRTUAL(&D_04010050);
this->life = initParams->life;
this->update = sUpdateFuncs[initParams->updateMode];
this->draw = EffectSsDust_Draw;
@ -129,7 +128,7 @@ void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
this->regs[SS_DUST_PRIM_B], 255);
gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_DUST_ENV_R], this->regs[SS_DUST_ENV_G],
this->regs[SS_DUST_ENV_B], this->regs[SS_DUST_ENV_A]);
gSPDisplayList(gfxCtx->polyXlu.p++, this->unk_38);
gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList);
}
Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_ss_dust.c", 389);

View file

@ -1,42 +1,155 @@
/*
* File: z_eff_ss_g_spk.c
* Overlay: ovl_Effect_Ss_G_Spk
* Description:
* Description: Fuse Sparks
*/
#include "z_eff_ss_g_spk.h"
typedef enum {
/* 0x00 */ SS_G_SPK_0,
/* 0x01 */ SS_G_SPK_1,
/* 0x02 */ SS_G_SPK_2,
/* 0x03 */ SS_G_SPK_3,
/* 0x04 */ SS_G_SPK_4,
/* 0x05 */ SS_G_SPK_5,
/* 0x06 */ SS_G_SPK_6,
/* 0x07 */ SS_G_SPK_7,
/* 0x08 */ SS_G_SPK_8,
/* 0x09 */ SS_G_SPK_9,
/* 0x0A */ SS_G_SPK_A,
/* 0x0B */ SS_G_SPK_B,
/* 0x0C */ SS_G_SPK_C,
} EffectSsG_SpkRegs;
/* 0x00 */ SS_G_SPK_PRIM_R,
/* 0x01 */ SS_G_SPK_PRIM_G,
/* 0x02 */ SS_G_SPK_PRIM_B,
/* 0x03 */ SS_G_SPK_PRIM_A,
/* 0x04 */ SS_G_SPK_ENV_R,
/* 0x05 */ SS_G_SPK_ENV_G,
/* 0x06 */ SS_G_SPK_ENV_B,
/* 0x07 */ SS_G_SPK_ENV_A,
/* 0x08 */ SS_G_SPK_TEX_IDX,
/* 0x09 */ SS_G_SPK_SCALE,
/* 0x0A */ SS_G_SPK_SCALE_STEP,
} EffectSsGSpkRegs;
#define SPARK_SOURCE ((Actor*)this->unk_3C)
u32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx);
void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsGSpk_Update(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsGSpk_UpdateNoAccel(GlobalContext* globalCtx, u32 index, EffectSs* this);
void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this);
/*
EffectSsInit Effect_Ss_G_Spk_InitVars = {
EFFECT_SS_G_SPK,
EffectSsGSpk_Init,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Spk/EffectSsGSpk_Init.s")
static UNK_PTR D_809A7498[] = {
0x04055FB0,
0x040561B0,
0x040563B0,
0x040565B0,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Spk/func_809A70A0.s")
extern Gfx D_04025550[];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Spk/func_809A72C0.s")
u32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
EffectSsGSpkInitParams* initParams = (EffectSsGSpkInitParams*)initParamsx;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/effects/ovl_Effect_Ss_G_Spk/func_809A73C8.s")
Math_Vec3f_Copy(&this->pos, &initParams->pos);
Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
Math_Vec3f_Copy(&this->accel, &initParams->accel);
this->displayList = SEGMENTED_TO_VIRTUAL(&D_04025550);
if (initParams->updateMode == 0) {
this->life = 10;
this->unk_2C.x = initParams->pos.x - initParams->actor->posRot.pos.x;
this->unk_2C.y = initParams->pos.y - initParams->actor->posRot.pos.y;
this->unk_2C.z = initParams->pos.z - initParams->actor->posRot.pos.z;
this->update = EffectSsGSpk_Update;
} else {
this->life = 5;
this->update = EffectSsGSpk_UpdateNoAccel;
}
this->draw = EffectSsGSpk_Draw;
this->regs[SS_G_SPK_PRIM_R] = initParams->primColor.r;
this->regs[SS_G_SPK_PRIM_G] = initParams->primColor.g;
this->regs[SS_G_SPK_PRIM_B] = initParams->primColor.b;
this->regs[SS_G_SPK_PRIM_A] = initParams->primColor.a;
this->regs[SS_G_SPK_ENV_R] = initParams->envColor.r;
this->regs[SS_G_SPK_ENV_G] = initParams->envColor.g;
this->regs[SS_G_SPK_ENV_B] = initParams->envColor.b;
this->regs[SS_G_SPK_ENV_A] = initParams->envColor.a;
this->regs[SS_G_SPK_TEX_IDX] = 0;
this->regs[SS_G_SPK_SCALE] = initParams->scale;
this->regs[SS_G_SPK_SCALE_STEP] = initParams->scaleStep;
this->unk_3C = initParams->actor;
return 1;
}
void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
s32 pad;
MtxF sp11C;
MtxF spDC;
MtxF sp9C;
MtxF sp5C;
Mtx* mtx;
f32 scale;
s32 pad1;
GraphicsContext* gfxCtx;
Gfx* dispRefs[4];
gfxCtx = globalCtx->state.gfxCtx;
Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_g_spk.c", 208);
scale = this->regs[SS_G_SPK_SCALE] * 0.0025f;
func_800A7A24(&sp11C, this->pos.x, this->pos.y, this->pos.z);
func_800A76A4(&spDC, scale, scale, 1.0f);
func_800A6FA0(&sp11C, &globalCtx->mf_11DA0, &sp5C);
func_800A6FA0(&sp5C, &spDC, &sp9C);
mtx = func_800A7E70(gfxCtx, &sp9C);
if (mtx != NULL) {
gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809A7498[this->regs[SS_G_SPK_TEX_IDX]]));
func_80094BC4(gfxCtx);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_G_SPK_PRIM_R], this->regs[SS_G_SPK_PRIM_G],
this->regs[SS_G_SPK_PRIM_B], 255);
gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_G_SPK_ENV_R], this->regs[SS_G_SPK_ENV_G],
this->regs[SS_G_SPK_ENV_B], this->regs[SS_G_SPK_ENV_A]);
gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList);
}
if (1) {}
if (1) {}
Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_g_spk.c", 255);
}
void EffectSsGSpk_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
this->accel.x = (Math_Rand_ZeroOne() - 0.5f) * 3.0f;
this->accel.z = (Math_Rand_ZeroOne() - 0.5f) * 3.0f;
if (SPARK_SOURCE != NULL) {
if ((SPARK_SOURCE->type == ACTORTYPE_EXPLOSIVES) && (SPARK_SOURCE->update != NULL)) {
this->pos.x = SPARK_SOURCE->posRot.pos.x + this->unk_2C.x;
this->pos.y = SPARK_SOURCE->posRot.pos.y + this->unk_2C.y;
this->pos.z = SPARK_SOURCE->posRot.pos.z + this->unk_2C.z;
}
}
this->unk_2C.x += this->accel.x;
this->unk_2C.z += this->accel.z;
this->regs[SS_G_SPK_TEX_IDX]++;
this->regs[SS_G_SPK_TEX_IDX] &= 3;
this->regs[SS_G_SPK_SCALE] += this->regs[SS_G_SPK_SCALE_STEP];
}
// this update mode is unused in the original game
// with this update mode, the sparks dont move randomly in the xz plane, appearing to be on top of each other
void EffectSsGSpk_UpdateNoAccel(GlobalContext* globalCtx, u32 index, EffectSs* this) {
if (SPARK_SOURCE != NULL) {
if ((SPARK_SOURCE->type == ACTORTYPE_EXPLOSIVES) && (SPARK_SOURCE->update != NULL)) {
this->pos.x += (Math_Sins(SPARK_SOURCE->posRot.rot.y) * SPARK_SOURCE->speedXZ);
this->pos.z += (Math_Coss(SPARK_SOURCE->posRot.rot.y) * SPARK_SOURCE->speedXZ);
}
}
this->regs[SS_G_SPK_TEX_IDX]++;
this->regs[SS_G_SPK_TEX_IDX] &= 3;
this->regs[SS_G_SPK_SCALE] += this->regs[SS_G_SPK_SCALE_STEP];
}

View file

@ -5,9 +5,15 @@
#include <global.h>
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
/* 0x18 */ Vec3f accel;
} EffectSsGSpkInitParams; // size = 0x
/* 0x00 */ Actor* actor;
/* 0x04 */ Vec3f pos;
/* 0x10 */ Vec3f velocity;
/* 0x1C */ Vec3f accel;
/* 0x28 */ Color_RGBA8 primColor;
/* 0x2C */ Color_RGBA8 envColor;
/* 0x30 */ s16 scale;
/* 0x32 */ s16 scaleStep;
/* 0x34 */ u8 updateMode;
} EffectSsGSpkInitParams; // size = 0x38
#endif