diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index e042feda0c..9f958e974d 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -1182,7 +1182,7 @@ - + diff --git a/spec b/spec index bef6cdca61..b0ad8b8b86 100644 --- a/spec +++ b/spec @@ -1938,8 +1938,7 @@ beginseg name "ovl_Effect_Ss_Dead_Ds" compress include "build/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.o" - include "build/data/ovl_Effect_Ss_Dead_Ds/ovl_Effect_Ss_Dead_Ds.data.o" - include "build/data/ovl_Effect_Ss_Dead_Ds/ovl_Effect_Ss_Dead_Ds.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/ovl_Effect_Ss_Dead_Ds_reloc.o" endseg beginseg diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c index 6dfbce5a19..5e8a1e4514 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Dd/z_eff_ss_dead_dd.c @@ -116,14 +116,13 @@ void EffectSsDeadDd_Draw(PlayState* play, u32 index, EffectSs* this) { gSPMatrix(POLY_XLU_DISP++, &D_01000000, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_054940); + gSPDisplayList(POLY_XLU_DISP++, gLensFlareCircleDL); } CLOSE_DISPS(gfxCtx); } void EffectSsDeadDd_Update(PlayState* play, u32 index, EffectSs* this) { - this->rScale += this->rScaleStep; if (this->rScale < 0) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c index e5079f55d7..7bf60c2a19 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c @@ -1,27 +1,124 @@ /* * File: z_eff_ss_dead_ds.c * Overlay: ovl_Effect_Ss_Dead_Ds - * Description: + * Description: Burn mark on the floor */ #include "z_eff_ss_dead_ds.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define rScale regs[0] +#define rTimer regs[1] +#define rRoll regs[2] +#define rPitch regs[3] +#define rYaw regs[4] +#define rAlpha regs[5] +#define rScaleStep regs[9] +#define rAlphaStep regs[10] +#define rHalfOfLife regs[11] #define PARAMS ((EffectSsDeadDsInitParams*)initParamsx) -s32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx); void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this); void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this); -#if 0 const EffectSsInit Effect_Ss_Dead_Ds_InitVars = { EFFECT_SS_DEAD_DS, EffectSsDeadDs_Init, }; -#endif +u32 EffectSsDeadDs_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { + EffectSsDeadDsInitParams* initParams = PARAMS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Ds/EffectSsDeadDs_Init.s") + this->pos = initParams->pos; + this->velocity = initParams->velocity; + this->accel = initParams->accel; + this->life = initParams->life; + this->rScaleStep = initParams->scaleStep; + this->rHalfOfLife = initParams->life / 2; + this->rAlphaStep = initParams->alpha / this->rHalfOfLife; + this->draw = EffectSsDeadDs_Draw; + this->update = EffectSsDeadDs_Update; + this->rScale = initParams->scale; + this->rAlpha = initParams->alpha; + this->rTimer = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Ds/EffectSsDeadDs_Draw.s") + return 1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Dead_Ds/EffectSsDeadDs_Update.s") +void EffectSsDeadDs_Draw(PlayState* play, u32 index, EffectSs* this) { + s32 pad; + f32 scale; + s32 pad2[2]; + MtxF mf; + f32 yIntersect; + Vec3f pos; + CollisionPoly* floorPoly; + + OPEN_DISPS(play->state.gfxCtx); + + scale = this->rScale * 0.01f; + func_8012C974(play->state.gfxCtx); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, this->rAlpha); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); + pos = this->pos; + + if (this->rTimer == 0) { + Vec3s rot; + Vec3f prevPos; + + prevPos.x = pos.x - this->velocity.x; + prevPos.y = pos.y - this->velocity.y; + prevPos.z = pos.z - this->velocity.z; + + if (BgCheck_EntitySphVsWall1(&play->colCtx, &this->pos, &pos, &prevPos, 1.5f, &floorPoly, 1.0f)) { + func_800C0094(floorPoly, this->pos.x, this->pos.y, this->pos.z, &mf); + Matrix_Put(&mf); + } else { + pos.y++; + yIntersect = BgCheck_EntityRaycastFloor1(&play->colCtx, &floorPoly, &pos); + + if (floorPoly != NULL) { + func_800C0094(floorPoly, this->pos.x, yIntersect + 1.5f, this->pos.z, &mf); + Matrix_Put(&mf); + } else { + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_Get(&mf); + } + } + + Matrix_MtxFToZYXRot(&mf, &rot, false); + this->rRoll = rot.x; + this->rPitch = rot.y; + this->rYaw = rot.z; + this->pos.y = mf.yw; + this->rTimer++; + } + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_RotateZYX(this->rRoll, this->rPitch, this->rYaw, MTXMODE_APPLY); + Matrix_RotateXFApply(1.57f); // (M_PI / 2) + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetCombineLERP(POLY_XLU_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, + PRIMITIVE, 0); + gSPDisplayList(POLY_XLU_DISP++, gLensFlareCircleDL); + + CLOSE_DISPS(play->state.gfxCtx); +} + +void EffectSsDeadDs_Update(PlayState* play, u32 index, EffectSs* this) { + if (this->life < this->rHalfOfLife) { + + this->rScale += this->rScaleStep; + if (this->rScale < 0) { + this->rScale = 0; + } + + this->rAlpha -= this->rAlphaStep; + if (this->rAlpha < 0) { + this->rAlpha = 0; + } + } +}