diff --git a/include/functions.h b/include/functions.h index 9a81e2ded3..416c7ca29a 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2552,7 +2552,7 @@ void func_80168DAC(PlayState* play); void Play_Main(PlayState* play); s32 Play_InCsMode(PlayState* play); f32 func_80169100(PlayState* play, MtxF* mtx, CollisionPoly** arg2, s32* arg3, Vec3f* feetPosPtr); -// void func_801691F0(void); +void func_801691F0(PlayState* play, MtxF* mtx, Vec3f* arg2); void* Play_LoadScene(PlayState* play, RomFile* entry); void func_8016927C(PlayState* play, s16 sParm2); // void func_801692C4(PlayState* play, UNK_TYPE1 uParm2); diff --git a/spec b/spec index 0e9d0a7817..334ff6bbb8 100644 --- a/spec +++ b/spec @@ -1758,8 +1758,7 @@ beginseg name "ovl_Effect_Ss_Blast" compress include "build/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.o" - include "build/data/ovl_Effect_Ss_Blast/ovl_Effect_Ss_Blast.data.o" - include "build/data/ovl_Effect_Ss_Blast/ovl_Effect_Ss_Blast.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Blast/ovl_Effect_Ss_Blast_reloc.o" endseg beginseg diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 6d1a9176e3..5fc51b0c33 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -298,7 +298,7 @@ void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Ve // EffectSsBlast Spawn Functions void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, - Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 sclaeStepDecay, s16 life) { + Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 scaleStepDecay, s16 life) { EffectSsBlastInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -308,7 +308,7 @@ void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac Color_RGBA8_Copy(&initParams.envColor, envColor); initParams.scale = scale; initParams.scaleStep = scaleStep; - initParams.sclaeStepDecay = sclaeStepDecay; + initParams.scaleStepDecay = scaleStepDecay; initParams.life = life; EffectSs_Spawn(play, EFFECT_SS_BLAST, 128, &initParams); diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c index bb4cada883..93353f28cc 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c @@ -1,27 +1,90 @@ /* * File: z_eff_ss_blast.c * Overlay: ovl_Effect_Ss_Blast - * Description: + * Description: Shockwave Effect */ #include "z_eff_ss_blast.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rPrimColorR regs[0] +#define rPrimColorG regs[1] +#define rPrimColorB regs[2] +#define rPrimColorA regs[3] +#define rEnvColorR regs[4] +#define rEnvColorG regs[5] +#define rEnvColorB regs[6] +#define rEnvColorA regs[7] +#define rAlphaStep regs[8] +#define rScale regs[9] +#define rScaleStep regs[10] +#define rScaleStepDecay regs[11] #define PARAMS ((EffectSsBlastInitParams*)initParamsx) -s32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_Blast_InitVars = { EFFECT_SS_BLAST, EffectSsBlast_Init, }; -#endif +u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsBlastInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Blast/EffectSsBlast_Init.s") + this->pos = initParams->pos; + this->pos.y += 5.0f; + this->velocity = initParams->velocity; + this->accel = initParams->accel; + this->gfx = gEffShockwaveDL; + this->life = initParams->life; + this->draw = EffectSsBlast_Draw; + this->update = EffectSsBlast_Update; + this->rPrimColorR = initParams->primColor.r; + this->rPrimColorG = initParams->primColor.g; + this->rPrimColorB = initParams->primColor.b; + this->rPrimColorA = initParams->primColor.a; + this->rEnvColorR = initParams->envColor.r; + this->rEnvColorG = initParams->envColor.g; + this->rEnvColorB = initParams->envColor.b; + this->rEnvColorA = initParams->envColor.a; + this->rAlphaStep = initParams->primColor.a / initParams->life; + this->rScale = initParams->scale; + this->rScaleStep = initParams->scaleStep; + this->rScaleStepDecay = initParams->scaleStepDecay; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Blast/EffectSsBlast_Draw.s") + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Blast/EffectSsBlast_Update.s") +void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + MtxF mf; + s32 pad; + f32 radius; + + OPEN_DISPS(gfxCtx); + + radius = this->rScale * 0.0025f; + + func_8012C2DC(play->state.gfxCtx); + gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA); + func_801691F0(play, &mf, &this->pos); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA); + Matrix_Put(&mf); + Matrix_Scale(radius, radius, radius, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, this->gfx); + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this) { + Math_StepToS(&this->rPrimColorA, 0, this->rAlphaStep); + this->rScale += this->rScaleStep; + + if (this->rScaleStep != 0) { + this->rScaleStep -= this->rScaleStepDecay; + } +} diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h index 2a13227c36..72a264c038 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h @@ -11,7 +11,7 @@ typedef struct { /* 0x28 */ Color_RGBA8 envColor; /* 0x2C */ s16 scale; /* 0x2E */ s16 scaleStep; - /* 0x30 */ s16 sclaeStepDecay; + /* 0x30 */ s16 scaleStepDecay; /* 0x32 */ s16 life; } EffectSsBlastInitParams; // size = 0x34