From b3104f898b50a5679ebdcfdb1ef364f1e924c65f Mon Sep 17 00:00:00 2001 From: Isghj <42048411+isghj5@users.noreply.github.com> Date: Sat, 18 Jun 2022 19:00:48 -0700 Subject: [PATCH] `Effect_Ss_Extra` (points that appear above targets in Swamp Archery Minigame) and `object_yabusame_point` (#822) * EffectExtra: start * EffectExtra: matched * EffectExtra: docs * EffectExtra: warnings * Update src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update assets/xml/objects/object_yabusame_point.xml Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * EffectExtra: fixes * Update src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c Co-authored-by: Derek Hensley God damn it lenovo * Extra delete * EffectExtra: namefixer * EffectExtra: updated brief description Co-authored-by: Isghj8 Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- assets/xml/objects/object_yabusame_point.xml | 6 +- spec | 3 +- .../ovl_Effect_Ss_Extra/z_eff_ss_extra.c | 84 +++++++++++++++++-- 3 files changed, 81 insertions(+), 12 deletions(-) diff --git a/assets/xml/objects/object_yabusame_point.xml b/assets/xml/objects/object_yabusame_point.xml index 856d94cfed..a7a3cac85e 100644 --- a/assets/xml/objects/object_yabusame_point.xml +++ b/assets/xml/objects/object_yabusame_point.xml @@ -1,6 +1,8 @@  - - + + + + diff --git a/spec b/spec index d0351563a4..0d3ee9e298 100644 --- a/spec +++ b/spec @@ -1965,8 +1965,7 @@ beginseg name "ovl_Effect_Ss_Extra" compress include "build/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.o" - include "build/data/ovl_Effect_Ss_Extra/ovl_Effect_Ss_Extra.data.o" - include "build/data/ovl_Effect_Ss_Extra/ovl_Effect_Ss_Extra.reloc.o" + include "build/src/overlays/effects/ovl_Effect_Ss_Extra/ovl_Effect_Ss_Extra_reloc.o" endseg beginseg diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index cd0359ae32..1de32d6cee 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -1,29 +1,97 @@ /* * File: z_eff_ss_extra.c * Overlay: ovl_Effect_Ss_Extra - * Description: + * Description: The floating points that pop-up in Swamp Bow Minigame + * i.e. 100 points for hitting the deku scrubs in the background */ #include "z_eff_ss_extra.h" +#include "objects/object_yabusame_point/object_yabusame_point.h" #define PARAMS ((EffectSsExtraInitParams*)initParamsx) -s32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); +u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx); void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this); void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this); -#if 0 +static s16 sScores[] = { 30, 60, 100 }; + const EffectSsInit Effect_Ss_Extra_InitVars = { EFFECT_SS_EXTRA, EffectSsExtra_Init, }; -#endif +static TexturePtr sPointTextures[] = { gYabusamePoint30Tex, gYabusamePoint60Tex, gYabusamePoint100Tex }; -extern UNK_TYPE D_06000DC0; +#define rObjId regs[0] +#define rTimer regs[1] +#define rScoreIndex regs[2] +#define rScale regs[3] -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Extra/EffectSsExtra_Init.s") +u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) { + s32 pad; + EffectSsExtraInitParams* params = PARAMS; + s32 objIndex; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Extra/EffectSsExtra_Draw.s") + objIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_YABUSAME_POINT); + if ((objIndex >= 0) && (Object_IsLoaded(&globalCtx->objectCtx, objIndex))) { + void* segBackup = gSegments[6]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Extra/EffectSsExtra_Update.s") + gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objIndex].segment); + + this->pos = params->pos; + this->velocity = params->velocity; + this->accel = params->accel; + this->draw = EffectSsExtra_Draw; + this->update = EffectSsExtra_Update; + this->life = 50; + this->rScoreIndex = params->scoreIdx; + this->rScale = params->scale; + this->rTimer = 5; + this->rObjId = objIndex; + + gSegments[6] = segBackup; + return 1; + } + return 0; +} + +void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { + s32 pad; + f32 scale; + void* storedSegment; + + scale = this->rScale / 100.0f; + storedSegment = globalCtx->objectCtx.status[this->rObjId].segment; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + gSegments[6] = PHYSICAL_TO_VIRTUAL(storedSegment); + + gSPSegment(POLY_XLU_DISP++, 0x06, storedSegment); + + Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + func_8012C2DC(globalCtx->state.gfxCtx); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sPointTextures[this->rScoreIndex])); + + gSPDisplayList(POLY_XLU_DISP++, &gYabusamePointDL); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} + +void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { + if (this->rTimer != 0) { + this->rTimer--; + } else { + this->velocity.y = 0.0f; + } + + if (this->rTimer == 1) { + globalCtx->interfaceCtx.unk_25C = sScores[this->rScoreIndex]; + } +}