summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIsghj <42048411+isghj5@users.noreply.github.com>2022-06-18 19:00:48 -0700
committerGitHub <noreply@github.com>2022-06-19 03:00:48 +0100
commitb3104f898b50a5679ebdcfdb1ef364f1e924c65f (patch)
tree4539a96f025c2076146db1a8c4a5002178fbfaf2 /src
parent271b7c78276f7488f4c75328d79364f3a1cd423d (diff)
`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 <hensley.derek58@gmail.com> God damn it lenovo * Extra delete * EffectExtra: namefixer * EffectExtra: updated brief description Co-authored-by: Isghj8 <isghj8@gmail.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c84
1 files changed, 76 insertions, 8 deletions
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 cd0359ae3..1de32d6ce 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 };
+
+#define rObjId regs[0]
+#define rTimer regs[1]
+#define rScoreIndex regs[2]
+#define rScale regs[3]
+
+u32 EffectSsExtra_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* initParamsx) {
+ s32 pad;
+ EffectSsExtraInitParams* params = PARAMS;
+ s32 objIndex;
+
+ objIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_YABUSAME_POINT);
+ if ((objIndex >= 0) && (Object_IsLoaded(&globalCtx->objectCtx, objIndex))) {
+ void* segBackup = gSegments[6];
+
+ 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]));
-extern UNK_TYPE D_06000DC0;
+ gSPDisplayList(POLY_XLU_DISP++, &gYabusamePointDL);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Extra/EffectSsExtra_Init.s")
+ CLOSE_DISPS(globalCtx->state.gfxCtx);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Extra/EffectSsExtra_Draw.s")
+void EffectSsExtra_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) {
+ if (this->rTimer != 0) {
+ this->rTimer--;
+ } else {
+ this->velocity.y = 0.0f;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Effect_Ss_Extra/EffectSsExtra_Update.s")
+ if (this->rTimer == 1) {
+ globalCtx->interfaceCtx.unk_25C = sScores[this->rScoreIndex];
+ }
+}