diff --git a/spec b/spec index f6fb137b26..fc536a6a4e 100644 --- a/spec +++ b/spec @@ -1908,8 +1908,7 @@ beginseg name "ovl_Effect_Ss_K_Fire" compress include "build/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.o" - include "build/data/ovl_Effect_Ss_K_Fire/ovl_Effect_Ss_K_Fire.data.o" - include "build/data/ovl_Effect_Ss_K_Fire/ovl_Effect_Ss_K_Fire.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_K_Fire/ovl_Effect_Ss_K_Fire_reloc.o" endseg beginseg diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index b477545c2d..e93210b89d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -5,23 +5,103 @@ */ #include "z_eff_ss_k_fire.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rAlpha regs[0] +#define rScroll regs[2] +#define rType regs[3] +#define rYScale regs[4] +#define rXZScale regs[5] +#define rScaleMax regs[6] #define PARAMS ((EffectSsKFireInitParams*)initParamsx) -s32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); void EffectSsKFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_K_Fire_InitVars = { EFFECT_SS_K_FIRE, EffectSsKFire_Init, }; -#endif +u32 EffectSsKFire_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { + EffectSsKFireInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_K_Fire/EffectSsKFire_Init.s") + this->pos = initParams->pos; + this->velocity = initParams->velocity; + this->accel = initParams->accel; + this->life = 100; + this->rScaleMax = initParams->scaleMax; + this->rAlpha = 255; + this->rScroll = Rand_ZeroFloat(5.0f) - 25; + this->rType = initParams->type; + this->draw = EffectSsKFire_Draw; + this->update = EffectSsKFire_Update; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_K_Fire/EffectSsKFire_Draw.s") + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_K_Fire/EffectSsKFire_Update.s") +void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { + s32 pad; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + f32 xzScale; + f32 yScale; + + xzScale = this->rXZScale / 10000.0f; + yScale = this->rYScale / 10000.0f; + + OPEN_DISPS(gfxCtx); + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_Scale(xzScale, yScale, xzScale, MTXMODE_APPLY); + func_8012C2DC(globalCtx->state.gfxCtx); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, + globalCtx->state.frames * this->rScroll, 0x20, 0x80)); + + if (this->rType >= 100) { + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, this->rAlpha); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 10, 0, 0); + } else { + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, this->rAlpha); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 0); + } + + gDPPipeSync(POLY_XLU_DISP++); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + + if ((index % 2) != 0) { + Matrix_RotateYF(M_PI, MTXMODE_APPLY); + } + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); + + CLOSE_DISPS(gfxCtx); +} + +void EffectSsKFire_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { + if (this->rXZScale < this->rScaleMax) { + this->rXZScale += 4; + this->rYScale += 4; + + if (this->rXZScale > this->rScaleMax) { + this->rXZScale = this->rScaleMax; + + if (this->rType != 3) { + this->rYScale = this->rScaleMax; + } + } + } else if (this->rAlpha > 0) { + this->rAlpha -= 10; + if (this->rAlpha <= 0) { + this->rAlpha = 0; + this->life = 0; + } + } + + if (this->rType == 3) { + this->rYScale++; + } +}