summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2023-08-16 02:28:12 +0200
committerGitHub <noreply@github.com>2023-08-15 20:28:12 -0400
commitd6207b17c2c6dd51d6136a86bee3deee66f45734 (patch)
treeb397e7c101222fe792c72a09524f5acf7a866225 /src
parent4dea0bfb26951a8a07ee4cbb9642d8bcd52ba71a (diff)
Doc/cleanup pass on effects 1 (#1421)
* Some doc/cleanup on `Effect_Ss_Fhg_Flash` * Some doc/cleanup on `Effect_Ss_Blast` * 11DA0 -> Billboard * doc three lerp funcs in effectss * Some doc/cleanup on `Effect_Ss_Bomb` * `rTexIdx` -> `rTexIndex` * lifespan * `LIFESPAN` -> `EFFSSBOMB_LIFESPAN` * --parentheses * Add todo about "having zapd forward declare static variables" * try rework comments on effects scale * lightning -> "a ball of electrical arcs" ?
Diffstat (limited to 'src')
-rw-r--r--src/code/z_eff_blure.c96
-rw-r--r--src/code/z_effect_soft_sprite.c21
-rw-r--r--src/code/z_effect_soft_sprite_old_init.c72
-rw-r--r--src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c2
-rw-r--r--src/overlays/actors/ovl_En_Ssh/z_en_ssh.c2
-rw-r--r--src/overlays/actors/ovl_En_St/z_en_st.c2
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c51
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.h4
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c42
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c48
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c16
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c24
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c83
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h8
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c10
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c20
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c30
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c10
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c10
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c10
20 files changed, 275 insertions, 286 deletions
diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c
index 242dac94d..75f8d80bc 100644
--- a/src/code/z_eff_blure.c
+++ b/src/code/z_eff_blure.c
@@ -295,9 +295,9 @@ void EffectBlure_GetComputedValues(EffectBlure* this, s32 index, f32 ratio, Vec3
switch (this->calcMode) {
case 1:
- vec1->x = func_80027E34(elem->p1.x, elem->p2.x, ratio);
- vec1->y = func_80027E34(elem->p1.y, elem->p2.y, ratio);
- vec1->z = func_80027E34(elem->p1.z, elem->p2.z, ratio);
+ vec1->x = EffectSs_LerpS16(elem->p1.x, elem->p2.x, ratio);
+ vec1->y = EffectSs_LerpS16(elem->p1.y, elem->p2.y, ratio);
+ vec1->z = EffectSs_LerpS16(elem->p1.z, elem->p2.z, ratio);
vec2->x = elem->p2.x;
vec2->y = elem->p2.y;
vec2->z = elem->p2.z;
@@ -307,19 +307,19 @@ void EffectBlure_GetComputedValues(EffectBlure* this, s32 index, f32 ratio, Vec3
vec1->x = elem->p1.x;
vec1->y = elem->p1.y;
vec1->z = elem->p1.z;
- vec2->x = func_80027E34(elem->p2.x, elem->p1.x, ratio);
- vec2->y = func_80027E34(elem->p2.y, elem->p1.y, ratio);
- vec2->z = func_80027E34(elem->p2.z, elem->p1.z, ratio);
+ vec2->x = EffectSs_LerpS16(elem->p2.x, elem->p1.x, ratio);
+ vec2->y = EffectSs_LerpS16(elem->p2.y, elem->p1.y, ratio);
+ vec2->z = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio);
break;
case 3:
ratio *= 0.5f;
- vec1->x = func_80027E34(elem->p1.x, elem->p2.x, ratio);
- vec1->y = func_80027E34(elem->p1.y, elem->p2.y, ratio);
- vec1->z = func_80027E34(elem->p1.z, elem->p2.z, ratio);
- vec2->x = func_80027E34(elem->p2.x, elem->p1.x, ratio);
- vec2->y = func_80027E34(elem->p2.y, elem->p1.y, ratio);
- vec2->z = func_80027E34(elem->p2.z, elem->p1.z, ratio);
+ vec1->x = EffectSs_LerpS16(elem->p1.x, elem->p2.x, ratio);
+ vec1->y = EffectSs_LerpS16(elem->p1.y, elem->p2.y, ratio);
+ vec1->z = EffectSs_LerpS16(elem->p1.z, elem->p2.z, ratio);
+ vec2->x = EffectSs_LerpS16(elem->p2.x, elem->p1.x, ratio);
+ vec2->y = EffectSs_LerpS16(elem->p2.y, elem->p1.y, ratio);
+ vec2->z = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio);
ratio *= 2.0f;
break;
@@ -356,14 +356,14 @@ void EffectBlure_GetComputedValues(EffectBlure* this, s32 index, f32 ratio, Vec3
color1->r = color1->g = color1->b = color1->a = 255;
color2->r = color2->g = color2->b = color2->a = 255;
} else {
- color1->r = func_80027E84(this->p1StartColor[0], this->p1EndColor[0], ratio);
- color1->g = func_80027E84(this->p1StartColor[1], this->p1EndColor[1], ratio);
- color1->b = func_80027E84(this->p1StartColor[2], this->p1EndColor[2], ratio);
- color1->a = func_80027E84(this->p1StartColor[3], this->p1EndColor[3], ratio);
- color2->r = func_80027E84(this->p2StartColor[0], this->p2EndColor[0], ratio);
- color2->g = func_80027E84(this->p2StartColor[1], this->p2EndColor[1], ratio);
- color2->b = func_80027E84(this->p2StartColor[2], this->p2EndColor[2], ratio);
- color2->a = func_80027E84(this->p2StartColor[3], this->p2EndColor[3], ratio);
+ color1->r = EffectSs_LerpU8(this->p1StartColor[0], this->p1EndColor[0], ratio);
+ color1->g = EffectSs_LerpU8(this->p1StartColor[1], this->p1EndColor[1], ratio);
+ color1->b = EffectSs_LerpU8(this->p1StartColor[2], this->p1EndColor[2], ratio);
+ color1->a = EffectSs_LerpU8(this->p1StartColor[3], this->p1EndColor[3], ratio);
+ color2->r = EffectSs_LerpU8(this->p2StartColor[0], this->p2EndColor[0], ratio);
+ color2->g = EffectSs_LerpU8(this->p2StartColor[1], this->p2EndColor[1], ratio);
+ color2->b = EffectSs_LerpU8(this->p2StartColor[2], this->p2EndColor[2], ratio);
+ color2->a = EffectSs_LerpU8(this->p2StartColor[3], this->p2EndColor[3], ratio);
}
}
@@ -618,18 +618,18 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem
vtx[j1].v.ob[0] = Math_FNearbyIntF(sp158.x);
vtx[j1].v.ob[1] = Math_FNearbyIntF(sp158.y);
vtx[j1].v.ob[2] = Math_FNearbyIntF(sp158.z);
- vtx[j1].v.cn[0] = func_80027E84(sp1A4.r, sp19C.r, temp_f28);
- vtx[j1].v.cn[1] = func_80027E84(sp1A4.g, sp19C.g, temp_f28);
- vtx[j1].v.cn[2] = func_80027E84(sp1A4.b, sp19C.b, temp_f28);
- vtx[j1].v.cn[3] = func_80027E84(sp1A4.a, sp19C.a, temp_f28);
+ vtx[j1].v.cn[0] = EffectSs_LerpU8(sp1A4.r, sp19C.r, temp_f28);
+ vtx[j1].v.cn[1] = EffectSs_LerpU8(sp1A4.g, sp19C.g, temp_f28);
+ vtx[j1].v.cn[2] = EffectSs_LerpU8(sp1A4.b, sp19C.b, temp_f28);
+ vtx[j1].v.cn[3] = EffectSs_LerpU8(sp1A4.a, sp19C.a, temp_f28);
vtx[j2].v.ob[0] = Math_FNearbyIntF(sp14C.x);
vtx[j2].v.ob[1] = Math_FNearbyIntF(sp14C.y);
vtx[j2].v.ob[2] = Math_FNearbyIntF(sp14C.z);
- vtx[j2].v.cn[0] = func_80027E84(sp1A0.r, sp198.r, temp_f28);
- vtx[j2].v.cn[1] = func_80027E84(sp1A0.g, sp198.g, temp_f28);
- vtx[j2].v.cn[2] = func_80027E84(sp1A0.b, sp198.b, temp_f28);
- vtx[j2].v.cn[3] = func_80027E84(sp1A0.a, sp198.a, temp_f28);
+ vtx[j2].v.cn[0] = EffectSs_LerpU8(sp1A0.r, sp198.r, temp_f28);
+ vtx[j2].v.cn[1] = EffectSs_LerpU8(sp1A0.g, sp198.g, temp_f28);
+ vtx[j2].v.cn[2] = EffectSs_LerpU8(sp1A0.b, sp198.b, temp_f28);
+ vtx[j2].v.cn[3] = EffectSs_LerpU8(sp1A0.a, sp198.a, temp_f28);
}
gSPVertex(POLY_XLU_DISP++, vtx, 16, 0);
@@ -957,9 +957,9 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
switch (this->calcMode) {
case 1:
- vtx[j].v.ob[0] = func_80027E34(elem->p1.x, elem->p2.x, ratio);
- vtx[j].v.ob[1] = func_80027E34(elem->p1.y, elem->p2.y, ratio);
- vtx[j].v.ob[2] = func_80027E34(elem->p1.z, elem->p2.z, ratio);
+ vtx[j].v.ob[0] = EffectSs_LerpS16(elem->p1.x, elem->p2.x, ratio);
+ vtx[j].v.ob[1] = EffectSs_LerpS16(elem->p1.y, elem->p2.y, ratio);
+ vtx[j].v.ob[2] = EffectSs_LerpS16(elem->p1.z, elem->p2.z, ratio);
vtx[j + 1].v.ob[0] = elem->p2.x;
vtx[j + 1].v.ob[1] = elem->p2.y;
vtx[j + 1].v.ob[2] = elem->p2.z;
@@ -968,18 +968,18 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
vtx[j].v.ob[0] = elem->p1.x;
vtx[j].v.ob[1] = elem->p1.y;
vtx[j].v.ob[2] = elem->p1.z;
- vtx[j + 1].v.ob[0] = func_80027E34(elem->p2.x, elem->p1.x, ratio);
- vtx[j + 1].v.ob[1] = func_80027E34(elem->p2.y, elem->p1.y, ratio);
- vtx[j + 1].v.ob[2] = func_80027E34(elem->p2.z, elem->p1.z, ratio);
+ vtx[j + 1].v.ob[0] = EffectSs_LerpS16(elem->p2.x, elem->p1.x, ratio);
+ vtx[j + 1].v.ob[1] = EffectSs_LerpS16(elem->p2.y, elem->p1.y, ratio);
+ vtx[j + 1].v.ob[2] = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio);
break;
case 3:
ratio = ratio * 0.5f;
- vtx[j].v.ob[0] = func_80027E34(elem->p1.x, elem->p2.x, ratio);
- vtx[j].v.ob[1] = func_80027E34(elem->p1.y, elem->p2.y, ratio);
- vtx[j].v.ob[2] = func_80027E34(elem->p1.z, elem->p2.z, ratio);
- vtx[j + 1].v.ob[0] = func_80027E34(elem->p2.x, elem->p1.x, ratio);
- vtx[j + 1].v.ob[1] = func_80027E34(elem->p2.y, elem->p1.y, ratio);
- vtx[j + 1].v.ob[2] = func_80027E34(elem->p2.z, elem->p1.z, ratio);
+ vtx[j].v.ob[0] = EffectSs_LerpS16(elem->p1.x, elem->p2.x, ratio);
+ vtx[j].v.ob[1] = EffectSs_LerpS16(elem->p1.y, elem->p2.y, ratio);
+ vtx[j].v.ob[2] = EffectSs_LerpS16(elem->p1.z, elem->p2.z, ratio);
+ vtx[j + 1].v.ob[0] = EffectSs_LerpS16(elem->p2.x, elem->p1.x, ratio);
+ vtx[j + 1].v.ob[1] = EffectSs_LerpS16(elem->p2.y, elem->p1.y, ratio);
+ vtx[j + 1].v.ob[2] = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio);
ratio = ratio + ratio;
break;
case 0:
@@ -996,19 +996,19 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
vtx[j].v.flag = 0;
vtx[j].v.tc[0] = 0;
vtx[j].v.tc[1] = 0;
- vtx[j].v.cn[0] = func_80027E84(this->p1StartColor[0], this->p1EndColor[0], ratio);
- vtx[j].v.cn[1] = func_80027E84(this->p1StartColor[1], this->p1EndColor[1], ratio);
- vtx[j].v.cn[2] = func_80027E84(this->p1StartColor[2], this->p1EndColor[2], ratio);
- vtx[j].v.cn[3] = func_80027E84(this->p1StartColor[3], this->p1EndColor[3], ratio);
+ vtx[j].v.cn[0] = EffectSs_LerpU8(this->p1StartColor[0], this->p1EndColor[0], ratio);
+ vtx[j].v.cn[1] = EffectSs_LerpU8(this->p1StartColor[1], this->p1EndColor[1], ratio);
+ vtx[j].v.cn[2] = EffectSs_LerpU8(this->p1StartColor[2], this->p1EndColor[2], ratio);
+ vtx[j].v.cn[3] = EffectSs_LerpU8(this->p1StartColor[3], this->p1EndColor[3], ratio);
j++;
vtx[j].v.flag = 0;
vtx[j].v.tc[0] = 0;
vtx[j].v.tc[1] = 0;
- vtx[j].v.cn[0] = func_80027E84(this->p2StartColor[0], this->p2EndColor[0], ratio);
- vtx[j].v.cn[1] = func_80027E84(this->p2StartColor[1], this->p2EndColor[1], ratio);
- vtx[j].v.cn[2] = func_80027E84(this->p2StartColor[2], this->p2EndColor[2], ratio);
- vtx[j].v.cn[3] = func_80027E84(this->p2StartColor[3], this->p2EndColor[3], ratio);
+ vtx[j].v.cn[0] = EffectSs_LerpU8(this->p2StartColor[0], this->p2EndColor[0], ratio);
+ vtx[j].v.cn[1] = EffectSs_LerpU8(this->p2StartColor[1], this->p2EndColor[1], ratio);
+ vtx[j].v.cn[2] = EffectSs_LerpU8(this->p2StartColor[2], this->p2EndColor[2], ratio);
+ vtx[j].v.cn[3] = EffectSs_LerpU8(this->p2StartColor[3], this->p2EndColor[3], ratio);
j++;
}
}
diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c
index 55a1245a3..6fb6e05d3 100644
--- a/src/code/z_effect_soft_sprite.c
+++ b/src/code/z_effect_soft_sprite.c
@@ -324,16 +324,25 @@ void EffectSs_DrawAll(PlayState* play) {
}
}
-s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2) {
- s16 ret = (arg2 == 0) ? arg1 : (arg0 + (s32)((arg1 - arg0) / (f32)arg2));
+/**
+ * Lerp from `a` (weightInv == inf) to `b` (weightInv == 1 or 0).
+ */
+s16 EffectSs_LerpInv(s16 a, s16 b, s32 weightInv) {
+ s16 ret = (weightInv == 0) ? b : (a + (s32)((b - a) / (f32)weightInv));
return ret;
}
-s16 func_80027E34(s16 arg0, s16 arg1, f32 arg2) {
- return (arg1 - arg0) * arg2 + arg0;
+/**
+ * Lerp from `a` (weight == 0) to `b` (weight == 1).
+ */
+s16 EffectSs_LerpS16(s16 a, s16 b, f32 weight) {
+ return (b - a) * weight + a;
}
-u8 func_80027E84(u8 arg0, u8 arg1, f32 arg2) {
- return arg2 * ((f32)arg1 - (f32)arg0) + arg0;
+/**
+ * Lerp from `a` (weight == 0) to `b` (weight == 1).
+ */
+u8 EffectSs_LerpU8(u8 a, u8 b, f32 weight) {
+ return weight * ((f32)b - (f32)a) + a;
}
diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c
index 5c6b95711..f2d7d0a54 100644
--- a/src/code/z_effect_soft_sprite_old_init.c
+++ b/src/code/z_effect_soft_sprite_old_init.c
@@ -46,7 +46,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) {
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
- MtxF mfTrans11DA0;
+ MtxF mfTransBillboard;
s32 pad1;
Mtx* mtx;
void* object = play->objectCtx.status[this->rgObjBankIdx].segment;
@@ -56,8 +56,8 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) {
scale = this->rgScale * 0.0025f;
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, scale);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
gSegments[6] = VIRTUAL_TO_PHYSICAL(object);
gSPSegment(POLY_XLU_DISP++, 0x06, object);
@@ -316,15 +316,26 @@ 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 scaleStepDecay, s16 life) {
+/**
+ * Spawn a ring-shaped shockwave effect.
+ *
+ * @param pos Position from which to find collision to draw the shockwave along.
+ * @param innerColor Color on the inside of the ring. Alpha is effect's alpha.
+ * @param outerColor Color on the outside of the ring.
+ * @param scale How large the shockwave is initially. The shockwave will be `scale*64/400` units wide.
+ * @param scaleStep How much to increase `scale` by each frame.
+ * @param scaleStepDecay How much to decrease `scaleStep` by each frame
+ * (should be a divisor of `scaleStep`, or small enough that `scaleStep` won't go negative).
+ */
+void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* innerColor,
+ Color_RGBA8* outerColor, s16 scale, s16 scaleStep, s16 scaleStepDecay, s16 life) {
EffectSsBlastParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
Math_Vec3f_Copy(&initParams.velocity, velocity);
Math_Vec3f_Copy(&initParams.accel, accel);
- Color_RGBA8_Copy(&initParams.primColor, primColor);
- Color_RGBA8_Copy(&initParams.envColor, envColor);
+ Color_RGBA8_Copy(&initParams.innerColor, innerColor);
+ Color_RGBA8_Copy(&initParams.outerColor, outerColor);
initParams.scale = scale;
initParams.scaleStep = scaleStep;
initParams.scaleStepDecay = scaleStepDecay;
@@ -333,24 +344,39 @@ void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac
EffectSs_Spawn(play, EFFECT_SS_BLAST, 128, &initParams);
}
-void EffectSsBlast_SpawnWhiteCustomScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
- s16 scaleStep, s16 life) {
- static Color_RGBA8 primColor = { 255, 255, 255, 255 };
- static Color_RGBA8 envColor = { 200, 200, 200, 0 };
+/**
+ * Spawn a white shockwave effect.
+ *
+ * @see EffectSsBlast_Spawn
+ */
+void EffectSsBlast_SpawnWhiteShockwaveSetScale(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
+ s16 scaleStep, s16 life) {
+ static Color_RGBA8 innerColor = { 255, 255, 255, 255 };
+ static Color_RGBA8 outerColor = { 200, 200, 200, 0 };
- EffectSsBlast_Spawn(play, pos, velocity, accel, &primColor, &envColor, scale, scaleStep, 35, life);
+ EffectSsBlast_Spawn(play, pos, velocity, accel, &innerColor, &outerColor, scale, scaleStep, 35, life);
}
-void EffectSsBlast_SpawnShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
- Color_RGBA8* envColor, s16 life) {
- EffectSsBlast_Spawn(play, pos, velocity, accel, primColor, envColor, 100, 375, 35, life);
+/**
+ * Spawn a shockwave effect, quickly expanding.
+ *
+ * @see EffectSsBlast_Spawn
+ */
+void EffectSsBlast_SpawnShockwaveSetColor(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel,
+ Color_RGBA8* innerColor, Color_RGBA8* outerColor, s16 life) {
+ EffectSsBlast_Spawn(play, pos, velocity, accel, innerColor, outerColor, 100, 375, 35, life);
}
+/**
+ * Spawn a white shockwave effect, quickly expanding, for 10 frames.
+ *
+ * @see EffectSsBlast_Spawn
+ */
void EffectSsBlast_SpawnWhiteShockwave(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
- static Color_RGBA8 primColor = { 255, 255, 255, 255 };
- static Color_RGBA8 envColor = { 200, 200, 200, 0 };
+ static Color_RGBA8 innerColor = { 255, 255, 255, 255 };
+ static Color_RGBA8 outerColor = { 200, 200, 200, 0 };
- EffectSsBlast_SpawnShockwave(play, pos, velocity, accel, &primColor, &envColor, 10);
+ EffectSsBlast_SpawnShockwaveSetColor(play, pos, velocity, accel, &innerColor, &outerColor, 10);
}
// EffectSsGSpk Spawn Functions
@@ -745,12 +771,12 @@ void EffectSsFhgFlash_SpawnLightBall(PlayState* play, Vec3f* pos, Vec3f* velocit
}
/**
- * Spawn a shock effect
+ * Spawn a purple shock effect (a ball of electrical arcs).
*
- * param determines where the ligntning should go
- * 0: don't attach to any actor. spawns at the position specified by pos
- * 1: spawn at one of Player's body parts, chosen at random
- * 2: spawn at one of Phantom Ganon's body parts, chosen at random
+ * @param actor If param is `FHGFLASH_SHOCK_PG`, the Phantom Ganon actor. Unused otherwise.
+ * @param pos If param is `FHGFLASH_SHOCK_NO_ACTOR`, the position of the effect. Unused otherwise.
+ * @param scale The effect will be around `scale*20/100` units wide (randomized).
+ * @param param Determines what the effect attaches to. See `FhgFlashLightningParam`.
*/
void EffectSsFhgFlash_SpawnShock(PlayState* play, Actor* actor, Vec3f* pos, s16 scale, u8 param) {
EffectSsFhgFlashInitParams initParams;
diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
index d920235bd..32c4cbd2c 100644
--- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
+++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
@@ -4161,7 +4161,7 @@ void BossGanon_LightBall_Draw(Actor* thisx, PlayState* play) {
}
} else if (this->unk_1A8 == 0) {
Matrix_ReplaceRotation(&play->billboardMtxF);
- Matrix_RotateZ((this->actor.shape.rot.z / 32768.0f) * 3.1416f, MTXMODE_APPLY);
+ Matrix_RotateZ((this->actor.shape.rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_ganon.c", 9907),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gGanondorfSquareDL);
diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
index 7447e736c..59d924aeb 100644
--- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
+++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c
@@ -122,7 +122,7 @@ void EnSsh_SpawnShockwave(EnSsh* this, PlayState* play) {
pos.x = this->actor.world.pos.x;
pos.y = this->actor.floorHeight;
pos.z = this->actor.world.pos.z;
- EffectSsBlast_SpawnWhiteCustomScale(play, &pos, &zeroVec, &zeroVec, 100, 220, 8);
+ EffectSsBlast_SpawnWhiteShockwaveSetScale(play, &pos, &zeroVec, &zeroVec, 100, 220, 8);
}
s32 EnSsh_CreateBlureEffect(PlayState* play) {
diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c
index e44f46f0d..1e0288fab 100644
--- a/src/overlays/actors/ovl_En_St/z_en_st.c
+++ b/src/overlays/actors/ovl_En_St/z_en_st.c
@@ -161,7 +161,7 @@ void EnSt_SpawnBlastEffect(EnSt* this, PlayState* play) {
blastPos.y = this->actor.floorHeight;
blastPos.z = this->actor.world.pos.z;
- EffectSsBlast_SpawnWhiteCustomScale(play, &blastPos, &zeroVec, &zeroVec, 100, 220, 8);
+ EffectSsBlast_SpawnWhiteShockwaveSetScale(play, &blastPos, &zeroVec, &zeroVec, 100, 220, 8);
}
void EnSt_SpawnDeadEffect(EnSt* this, PlayState* play) {
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 3261f10f6..22b97ce74 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
@@ -7,15 +7,15 @@
#include "z_eff_ss_blast.h"
#include "assets/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 rAlphaTarget regs[8]
+#define rInnerColorR regs[0]
+#define rInnerColorG regs[1]
+#define rInnerColorB regs[2]
+#define rInnerColorA regs[3]
+#define rOuterColorR regs[4]
+#define rOuterColorG regs[5]
+#define rOuterColorB regs[6]
+#define rOuterColorA regs[7]
+#define rAlphaStep regs[8]
#define rScale regs[9]
#define rScaleStep regs[10]
#define rScaleStepDecay regs[11]
@@ -40,15 +40,15 @@ u32 EffectSsBlast_Init(PlayState* play, u32 index, EffectSs* this, void* initPar
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->rAlphaTarget = initParams->primColor.a / initParams->life;
+ this->rInnerColorR = initParams->innerColor.r;
+ this->rInnerColorG = initParams->innerColor.g;
+ this->rInnerColorB = initParams->innerColor.b;
+ this->rInnerColorA = initParams->innerColor.a;
+ this->rOuterColorR = initParams->outerColor.r;
+ this->rOuterColorG = initParams->outerColor.g;
+ this->rOuterColorB = initParams->outerColor.b;
+ this->rOuterColorA = initParams->outerColor.a;
+ this->rAlphaStep = initParams->innerColor.a / initParams->life;
this->rScale = initParams->scale;
this->rScaleStep = initParams->scaleStep;
this->rScaleStepDecay = initParams->scaleStepDecay;
@@ -59,18 +59,19 @@ void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
MtxF mf;
s32 pad;
- f32 radius;
+ f32 scale;
OPEN_DISPS(gfxCtx, "../z_eff_ss_blast.c", 170);
- radius = this->rScale * 0.0025f;
+ scale = this->rScale * (1 / 400.0f);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
- gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA);
+ gDPSetEnvColor(POLY_XLU_DISP++, this->rOuterColorR, this->rOuterColorG, this->rOuterColorB, this->rOuterColorA);
func_800BFCB8(play, &mf, &this->pos);
- gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rInnerColorR, this->rInnerColorG, this->rInnerColorB,
+ this->rInnerColorA);
Matrix_Put(&mf);
- Matrix_Scale(radius, radius, radius, MTXMODE_APPLY);
+ Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_ss_blast.c", 199),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
@@ -79,9 +80,9 @@ void EffectSsBlast_Draw(PlayState* play, u32 index, EffectSs* this) {
}
void EffectSsBlast_Update(PlayState* play, u32 index, EffectSs* this) {
- Math_StepToS(&this->rPrimColorA, 0, this->rAlphaTarget);
- this->rScale += this->rScaleStep;
+ Math_StepToS(&this->rInnerColorA, 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 a5d4c2e0d..465997e75 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
@@ -8,8 +8,8 @@ typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
/* 0x18 */ Vec3f accel;
- /* 0x24 */ Color_RGBA8 primColor;
- /* 0x28 */ Color_RGBA8 envColor;
+ /* 0x24 */ Color_RGBA8 innerColor;
+ /* 0x28 */ Color_RGBA8 outerColor;
/* 0x2C */ s16 scale;
/* 0x2E */ s16 scaleStep;
/* 0x30 */ s16 scaleStepDecay;
diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c
index e64c991d2..aed5572b3 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c
@@ -7,8 +7,10 @@
#include "z_eff_ss_bomb.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
+#define EFFSSBOMB_LIFESPAN 20
+
#define rScale regs[0]
-#define rTexIdx regs[1]
+#define rTexIndex regs[1]
u32 EffectSsBomb_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this);
@@ -26,31 +28,32 @@ u32 EffectSsBomb_Init(PlayState* play, u32 index, EffectSs* this, void* initPara
Math_Vec3f_Copy(&this->velocity, &initParams->velocity);
Math_Vec3f_Copy(&this->accel, &initParams->accel);
this->gfx = SEGMENTED_TO_VIRTUAL(gEffBombExplosion1DL);
- this->life = 20;
+ this->life = EFFSSBOMB_LIFESPAN;
this->draw = EffectSsBomb_Draw;
this->update = EffectSsBomb_Update;
this->rScale = 100;
- this->rTexIdx = 0;
+ this->rTexIndex = 0;
return 1;
}
+static void* sExplosionTextures[] = {
+ gEffBombExplosion1Tex,
+ gEffBombExplosion2Tex,
+ gEffBombExplosion3Tex,
+ gEffBombExplosion4Tex,
+};
+
void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this) {
- static void* explosionTextures[] = {
- gEffBombExplosion1Tex,
- gEffBombExplosion2Tex,
- gEffBombExplosion3Tex,
- gEffBombExplosion4Tex,
- };
GraphicsContext* gfxCtx = play->state.gfxCtx;
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
- MtxF mfTrans11DA0;
+ MtxF mfTransBillboard;
Mtx* mtx;
s32 pad;
f32 scale;
- s16 color;
+ s16 intensity;
if (1) {}
@@ -60,8 +63,8 @@ void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this) {
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -69,12 +72,13 @@ void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this) {
if (mtx != NULL) {
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(explosionTextures[this->rTexIdx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sExplosionTextures[this->rTexIndex]));
gDPPipeSync(POLY_XLU_DISP++);
Gfx_SetupDL_61Xlu(gfxCtx);
- color = this->life * 12.75f;
- gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, color, color, color, color);
+ intensity = this->life * ((f32)255 / EFFSSBOMB_LIFESPAN);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, intensity, intensity, intensity, intensity);
gDPPipeSync(POLY_XLU_DISP++);
+ //! @bug env color is not set but used in gEffBombExplosion1DL
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
gDPPipeSync(POLY_XLU_DISP++);
}
@@ -83,11 +87,11 @@ void EffectSsBomb_Draw(PlayState* play, u32 index, EffectSs* this) {
}
void EffectSsBomb_Update(PlayState* play, u32 index, EffectSs* this) {
- if ((this->life < 21) && (this->life > 16)) {
- this->rTexIdx = (20 - this->life);
+ if ((this->life <= EFFSSBOMB_LIFESPAN) && (this->life > (EFFSSBOMB_LIFESPAN - ARRAY_COUNT(sExplosionTextures)))) {
+ this->rTexIndex = (EFFSSBOMB_LIFESPAN - this->life);
} else {
this->rScale += 0;
- this->rTexIdx = 3;
+ this->rTexIndex = ARRAY_COUNT(sExplosionTextures) - 1;
}
this->accel.x = ((Rand_ZeroOne() * 0.4f) - 0.2f);
diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c
index 03f5a02f9..bff52614a 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c
@@ -8,7 +8,7 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#define rScale regs[0]
-#define rTexIdx regs[1]
+#define rTexIndex regs[1]
#define rPrimColorR regs[2]
#define rPrimColorG regs[3]
#define rPrimColorB regs[4]
@@ -68,7 +68,7 @@ void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this) {
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
- MtxF mfTrans11DA0;
+ MtxF mfTransBillboard;
Mtx* mtx;
s32 pad;
f32 scale;
@@ -78,8 +78,8 @@ void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this) {
scale = this->rScale * 0.01f;
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
@@ -89,7 +89,7 @@ void EffectSsBomb2_DrawFade(PlayState* play, u32 index, EffectSs* this) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
this->rPrimColorA);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0);
- gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(textures[this->rTexIdx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(textures[this->rTexIndex]));
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
}
@@ -108,7 +108,7 @@ void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this) {
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
- MtxF mfTrans11DA0;
+ MtxF mfTransBillboard;
MtxF mtx2F;
Mtx* mtx2;
Mtx* mtx;
@@ -124,8 +124,8 @@ void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this) {
scale = this->rScale * 0.01f;
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
@@ -139,7 +139,7 @@ void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
this->rPrimColorA);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0);
- gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(textures[this->rTexIdx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(textures[this->rTexIndex]));
gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion2DL);
gSPDisplayList(POLY_XLU_DISP++, gEffBombExplosion3DL);
@@ -167,7 +167,7 @@ void EffectSsBomb2_DrawLayered(PlayState* play, u32 index, EffectSs* this) {
void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this) {
s32 divisor;
- this->rTexIdx = (23 - this->life) / 3;
+ this->rTexIndex = (23 - this->life) / 3;
this->rScale += this->rScaleStep;
if (this->rScaleStep == 30) {
@@ -178,21 +178,21 @@ void EffectSsBomb2_Update(PlayState* play, u32 index, EffectSs* this) {
if ((this->life < 23) && (this->life > 13)) {
divisor = this->life - 13;
- this->rPrimColorR = func_80027DD4(this->rPrimColorR, 255, divisor);
- this->rPrimColorG = func_80027DD4(this->rPrimColorG, 255, divisor);
- this->rPrimColorB = func_80027DD4(this->rPrimColorB, 150, divisor);
- this->rPrimColorA = func_80027DD4(this->rPrimColorA, 255, divisor);
- this->rEnvColorR = func_80027DD4(this->rEnvColorR, 150, divisor);
- this->rEnvColorG = func_80027DD4(this->rEnvColorG, 0, divisor);
- this->rEnvColorB = func_80027DD4(this->rEnvColorB, 0, divisor);
+ this->rPrimColorR = EffectSs_LerpInv(this->rPrimColorR, 255, divisor);
+ this->rPrimColorG = EffectSs_LerpInv(this->rPrimColorG, 255, divisor);
+ this->rPrimColorB = EffectSs_LerpInv(this->rPrimColorB, 150, divisor);
+ this->rPrimColorA = EffectSs_LerpInv(this->rPrimColorA, 255, divisor);
+ this->rEnvColorR = EffectSs_LerpInv(this->rEnvColorR, 150, divisor);
+ this->rEnvColorG = EffectSs_LerpInv(this->rEnvColorG, 0, divisor);
+ this->rEnvColorB = EffectSs_LerpInv(this->rEnvColorB, 0, divisor);
} else if ((this->life < 14) && (this->life > -1)) {
divisor = this->life + 1;
- this->rPrimColorR = func_80027DD4(this->rPrimColorR, 50, divisor);
- this->rPrimColorG = func_80027DD4(this->rPrimColorG, 50, divisor);
- this->rPrimColorB = func_80027DD4(this->rPrimColorB, 50, divisor);
- this->rPrimColorA = func_80027DD4(this->rPrimColorA, 150, divisor);
- this->rEnvColorR = func_80027DD4(this->rEnvColorR, 10, divisor);
- this->rEnvColorG = func_80027DD4(this->rEnvColorG, 10, divisor);
- this->rEnvColorB = func_80027DD4(this->rEnvColorB, 10, divisor);
+ this->rPrimColorR = EffectSs_LerpInv(this->rPrimColorR, 50, divisor);
+ this->rPrimColorG = EffectSs_LerpInv(this->rPrimColorG, 50, divisor);
+ this->rPrimColorB = EffectSs_LerpInv(this->rPrimColorB, 50, divisor);
+ this->rPrimColorA = EffectSs_LerpInv(this->rPrimColorA, 150, divisor);
+ this->rEnvColorR = EffectSs_LerpInv(this->rEnvColorR, 10, divisor);
+ this->rEnvColorG = EffectSs_LerpInv(this->rEnvColorG, 10, divisor);
+ this->rEnvColorB = EffectSs_LerpInv(this->rEnvColorB, 10, divisor);
}
}
diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c
index 9a5127e8a..b52bdfb79 100644
--- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c
+++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.c
@@ -8,7 +8,7 @@
#include "assets/objects/object_dodongo/object_dodongo.h"
#define rScale regs[0]
-#define rTexIdx regs[1]
+#define rTexIndex regs[1]
#define rPrimColorR regs[2]
#define rPrimColorG regs[3]
#define rPrimColorB regs[4]
@@ -48,7 +48,7 @@ u32 EffectSsDFire_Init(PlayState* play, u32 index, EffectSs* this, void* initPar
this->rObjBankIdx = objBankIndex;
this->draw = EffectSsDFire_Draw;
this->update = EffectSsDFire_Update;
- this->rTexIdx = ((s16)(play->state.frames % 4) ^ 3);
+ this->rTexIndex = ((s16)(play->state.frames % 4) ^ 3);
this->rPrimColorR = 255;
this->rPrimColorG = 255;
this->rPrimColorB = 50;
@@ -68,7 +68,7 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) {
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
- MtxF mfTrans11DA0;
+ MtxF mfTransBillboard;
s32 pad;
void* object;
Mtx* mtx;
@@ -84,8 +84,8 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) {
scale = this->rScale / 100.0f;
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
@@ -96,7 +96,7 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB,
this->rPrimColorA);
gSegments[6] = VIRTUAL_TO_PHYSICAL(object);
- gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rTexIdx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rTexIndex]));
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
}
}
@@ -105,8 +105,8 @@ void EffectSsDFire_Draw(PlayState* play, u32 index, EffectSs* this) {
}
void EffectSsDFire_Update(PlayState* play, u32 index, EffectSs* this) {
- this->rTexIdx++;
- this->rTexIdx &= 3;
+ this->rTexIndex++;
+ this->rTexIndex &= 3;
this->rScale += this->rScaleStep;
if (this->rFadeDelay >= this->life) {
diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c
index 7610d1c07..1910c5914 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c
@@ -15,7 +15,7 @@
#define rEnvColorG regs[5]
#define rEnvColorB regs[6]
#define rEnvColorA regs[7]
-#define rTexIdx regs[8] // this reg is also used to set specific colors in the fire update function
+#define rTexIndex regs[8] // this reg is also used to set specific colors in the fire update function
#define rScale regs[9]
#define rScaleStep regs[10]
#define rDrawFlags regs[11]
@@ -67,7 +67,7 @@ u32 EffectSsDust_Init(PlayState* play, u32 index, EffectSs* this, void* initPara
this->rPrimColorA = initParams->primColor.a;
this->rEnvColorA = initParams->envColor.a;
- this->rTexIdx = 0;
+ this->rTexIndex = 0;
this->rScale = initParams->scale;
this->rScaleStep = initParams->scaleStep;
this->rLifespan = initParams->life;
@@ -84,7 +84,7 @@ void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this) {
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
- MtxF mfTrans11DA0;
+ MtxF mfTransBillboard;
s32 pad;
Mtx* mtx;
f32 scale;
@@ -94,8 +94,8 @@ void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this) {
scale = this->rScale * 0.0025f;
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
@@ -103,7 +103,7 @@ void EffectSsDust_Draw(PlayState* play, u32 index, EffectSs* this) {
if (mtx != NULL) {
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPPipeSync(POLY_XLU_DISP++);
- gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTextures[this->rTexIdx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTextures[this->rTexIndex]));
POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0);
gDPPipeSync(POLY_XLU_DISP++);
@@ -134,12 +134,12 @@ void EffectSsDust_Update(PlayState* play, u32 index, EffectSs* this) {
if ((this->life <= this->rLifespan) && (this->life >= (this->rLifespan - 7))) {
if (this->rLifespan >= 5) {
- this->rTexIdx = this->rLifespan - this->life;
+ this->rTexIndex = this->rLifespan - this->life;
} else {
- this->rTexIdx = ((this->rLifespan - this->life) * (8 / this->rLifespan));
+ this->rTexIndex = (this->rLifespan - this->life) * (8 / this->rLifespan);
}
} else {
- this->rTexIdx = 7;
+ this->rTexIndex = 7;
}
this->rScale += this->rScaleStep;
@@ -150,7 +150,7 @@ void EffectSsDust_UpdateFire(PlayState* play, u32 index, EffectSs* this) {
this->accel.x = (Rand_ZeroOne() * 0.4f) - 0.2f;
this->accel.z = (Rand_ZeroOne() * 0.4f) - 0.2f;
- switch (this->rTexIdx) {
+ switch (this->rTexIndex) {
case 0:
this->rPrimColorR = 255;
this->rPrimColorG = 150;
@@ -181,8 +181,8 @@ void EffectSsDust_UpdateFire(PlayState* play, u32 index, EffectSs* this) {
break;
}
- if (this->rTexIdx < 7) {
- this->rTexIdx++;
+ if (this->rTexIndex < 7) {
+ this->rTexIndex++;
}
this->rScale += this->rScaleStep;
diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
index 464f31e58..29451fdb4 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c
@@ -25,15 +25,16 @@ EffectSsInit Effect_Ss_Fhg_Flash_InitVars = {
EffectSsFhgFlash_Init,
};
-static UNK_TYPE D_809A5178[258];
-static Gfx D_809A5100[15];
+// Should eventually come from assets/overlays/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.h
+//! TODO: investigate having ZAPD forward declare static variables
+static Gfx sShockDL[15];
u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) {
EffectSsFhgFlashInitParams* initParams = (EffectSsFhgFlashInitParams*)initParamsx;
s32 pad;
s32 objBankIdx;
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
- Vec3f sp34 = { 0.0f, -1000.0f, 0.0f };
+ Vec3f farAwayVec = { 0.0f, -1000.0f, 0.0f };
uintptr_t oldSeg6;
if (initParams->type == FHGFLASH_LIGHTBALL) {
@@ -69,17 +70,17 @@ u32 EffectSsFhgFlash_Init(PlayState* play, u32 index, EffectSs* this, void* init
this->rParam = initParams->param;
if (initParams->param != FHGFLASH_SHOCK_NO_ACTOR) {
- this->pos = sp34;
- this->gfx = SEGMENTED_TO_VIRTUAL(D_809A5100);
+ this->pos = farAwayVec; // Set the initial position to where the effect cannot be seen
+ this->gfx = SEGMENTED_TO_VIRTUAL(sShockDL);
} else {
this->pos = initParams->pos;
- this->gfx = SEGMENTED_TO_VIRTUAL(D_809A5100);
+ this->gfx = SEGMENTED_TO_VIRTUAL(sShockDL);
}
}
return 1;
}
-static Color_RGB8 sColors[] = {
+static Color_RGB8 sLightBallColors[] = {
{ 165, 255, 61 }, { 0, 255, 255 }, { 255, 40, 0 }, { 255, 255, 0 }, { 0, 0, 255 },
{ 255, 0, 255 }, { 255, 150, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
};
@@ -101,10 +102,11 @@ void EffectSsFhgFlash_DrawLightBall(PlayState* play, u32 index, EffectSs* this)
gSPSegment(POLY_XLU_DISP++, 0x06, object);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha);
- gDPSetEnvColor(POLY_XLU_DISP++, sColors[this->rParam].r, sColors[this->rParam].g, sColors[this->rParam].b, 0);
+ gDPSetEnvColor(POLY_XLU_DISP++, sLightBallColors[this->rParam].r, sLightBallColors[this->rParam].g,
+ sLightBallColors[this->rParam].b, 0);
gDPPipeSync(POLY_XLU_DISP++);
Matrix_ReplaceRotation(&play->billboardMtxF);
- Matrix_RotateZ((this->rXZRot / 32768.0f) * 3.1416f, MTXMODE_APPLY);
+ Matrix_RotateZ((this->rXZRot / (f32)0x8000) * 3.1416f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_fhg_flash.c", 326),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
@@ -126,7 +128,7 @@ void EffectSsFhgFlash_DrawShock(PlayState* play, u32 index, EffectSs* this) {
if (this->rParam != FHGFLASH_SHOCK_NO_ACTOR) {
Gfx_SetupDL_44Xlu(play->state.gfxCtx);
- Matrix_RotateX((this->rXZRot / 32768.0f) * 1.1416f, MTXMODE_APPLY);
+ Matrix_RotateX((this->rXZRot / (f32)0x8000) * 1.1416f, MTXMODE_APPLY);
gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_DECAL2);
} else {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
@@ -137,7 +139,7 @@ void EffectSsFhgFlash_DrawShock(PlayState* play, u32 index, EffectSs* this) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 155, 0);
- Matrix_RotateZ((this->rXZRot / 32768.0f) * 3.1416f, MTXMODE_APPLY);
+ Matrix_RotateZ((this->rXZRot / (f32)0x8000) * 3.1416f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_fhg_flash.c", 395),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
@@ -172,10 +174,10 @@ void EffectSsFhgFlash_UpdateShock(PlayState* play, u32 index, EffectSs* this) {
s16 randBodyPart;
Player* player;
BossGanondrof* phantomGanon;
- s16 rand;
+ s16 rotStep;
- rand = (Rand_ZeroOne() * 20000.0f);
- this->rXZRot = (this->rXZRot + rand) + 0x4000;
+ rotStep = Rand_ZeroOne() * 20000.0f;
+ this->rXZRot += rotStep + 0x4000;
if (this->rParam == FHGFLASH_SHOCK_PLAYER) {
player = GET_PLAYER(play);
@@ -201,55 +203,4 @@ void EffectSsFhgFlash_UpdateShock(PlayState* play, u32 index, EffectSs* this) {
}
}
-static Vtx D_809A50C0[4] = {
- VTX(-10, -10, 0, 0, 1024, 0xFF, 0xFF, 0xFF, 0xFF),
- VTX(10, -10, 0, 1024, 1024, 0xFF, 0xFF, 0xFF, 0xFF),
- VTX(10, 10, 0, 1024, 0, 0xFF, 0xFF, 0xFF, 0xFF),
- VTX(-10, 10, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF),
-};
-
-static Gfx D_809A5100[15] = {
- gsDPPipeSync(),
- gsDPSetTextureLUT(G_TT_NONE),
- gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
- gsDPLoadTextureBlock(D_809A5178, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, G_TX_MIRROR | G_TX_WRAP,
- G_TX_MIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD),
- gsDPSetCombineLERP(PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0,
- COMBINED),
- gsSPClearGeometryMode(G_CULL_BACK | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR),
- gsSPVertex(D_809A50C0, 4, 0),
- gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
- gsSPEndDisplayList(),
-};
-
-static UNK_TYPE D_809A5178[258] = {
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x005B3000, 0x00000000, 0x00000000,
- 0x00000000, 0x000B0000, 0x07000000, 0x00000000, 0x00000000, 0x005BB64B, 0x3A000000, 0x00000000, 0x00000000,
- 0x005B0000, 0x00000000, 0x00000000, 0x00000000, 0x001E00B6, 0xFF5B0000, 0x00000000, 0x00000000, 0x00251F0C,
- 0x07000000, 0x0A000000, 0x00000000, 0x00000000, 0xB6FF0000, 0x00000000, 0x00000000, 0x00255B00, 0x071F1E14,
- 0x0A000000, 0x00000000, 0x00000000, 0x00457350, 0x00000000, 0x00000000, 0x00295B8C, 0x5B5B0000, 0x00000000,
- 0x00000000, 0x00000000, 0x00455C39, 0x0F000000, 0x00000000, 0x0000A1FF, 0x5B000000, 0x00000000, 0x00000000,
- 0x00000000, 0x005B5B00, 0x00000000, 0x00000000, 0x005B311C, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x5BB60000, 0x00000000, 0x00000000, 0x5BB63100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFFB60000,
- 0x00000000, 0x00000046, 0xEA310000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0072B646, 0x00000000,
- 0x0000B6A1, 0x81000000, 0x00000000, 0x00000000, 0x00000000, 0x000C0000, 0x00172E19, 0xBDAB5D41, 0x366BEAEA,
- 0x81000000, 0x00000000, 0x00000000, 0x00000000, 0x06000000, 0x00000074, 0xFFFF0500, 0x0A2342B6, 0xFF000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x005B0000, 0x03030100, 0x00FF0700, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00020503, 0x00000000, 0x00466200, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00076200, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00002962, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00003EA1, 0x62000000, 0x00000000, 0x00000000, 0x0000002E, 0xB6350000,
- 0x00000000, 0x00000000, 0x000000EA, 0x46000000, 0x00000000, 0x00000000, 0x00002EFF, 0xFF5A0000, 0x00000000,
- 0x00000000, 0x000000FF, 0xFF001700, 0x00000000, 0x00000000, 0x01015BFF, 0xA1A10000, 0x00000000, 0x00000000,
- 0x00030046, 0x97732100, 0x00000000, 0x00000000, 0x040CB65E, 0x4A5B4600, 0x00000000, 0x00000003, 0x0C0E8C46,
- 0x1C035C00, 0x00000000, 0x00000017, 0x134F5B00, 0x00000046, 0x46000000, 0x00000000, 0x34D20000, 0x0401005B,
- 0x00000000, 0x00000000, 0x5BB60000, 0x00000000, 0x30FCB600, 0x0000A1E7, 0x00000001, 0x0100141E, 0x5B000000,
- 0x00000000, 0x00000000, 0x00000000, 0x0000A1FF, 0x5B46FF00, 0x00000100, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x000000FC, 0xFFA13100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0xB6000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
- 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
-};
+#include "assets/overlays/ovl_Effect_Ss_Fhg_Flash/ovl_Effect_Ss_Fhg_Flash.c"
diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h
index 4a56d0b9f..0d2d9616e 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h
+++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h
@@ -32,11 +32,9 @@ typedef enum {
} FhgFlashLightBallParam;
typedef enum {
- /* 0x00 */ FHGFLASH_SHOCK_NO_ACTOR,
- /* 0x01 */ FHGFLASH_SHOCK_PLAYER,
- /* 0x02 */ FHGFLASH_SHOCK_PG
+ /* 0x00 */ FHGFLASH_SHOCK_NO_ACTOR, // Don't attach to any actor. Stays at a fixed position.
+ /* 0x01 */ FHGFLASH_SHOCK_PLAYER, // Move to a random Player body part every frame.
+ /* 0x02 */ FHGFLASH_SHOCK_PG // Move to a random Phantom Ganon body part every frame.
} FhgFlashLightningParam;
-
-
#endif
diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c
index 1469e74ce..b7cda8ced 100644
--- a/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c
+++ b/src/overlays/effects/ovl_Effect_Ss_G_Magma2/z_eff_ss_g_magma2.c
@@ -13,7 +13,7 @@
#define rEnvColorR regs[3]
#define rEnvColorG regs[4]
#define rEnvColorA regs[5]
-#define rTexIdx regs[6]
+#define rTexIndex regs[6]
#define rTimer regs[7]
#define rUpdateRate regs[8]
#define rDrawMode regs[9]
@@ -54,7 +54,7 @@ u32 EffectSsGMagma2_Init(PlayState* play, u32 index, EffectSs* this, void* initP
this->draw = EffectSsGMagma2_Draw;
this->update = EffectSsGMagma2_Update;
this->gfx = SEGMENTED_TO_VIRTUAL(object_kingdodongo_DL_025A90);
- this->rTexIdx = 0;
+ this->rTexIndex = 0;
this->rDrawMode = initParams->drawMode;
this->rUpdateRate = initParams->updateRate;
this->rScale = initParams->scale;
@@ -97,7 +97,7 @@ void EffectSsGMagma2_Draw(PlayState* play, u32 index, EffectSs* this) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, 0, this->rPrimColorA);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, 0, this->rEnvColorA);
- gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rTexIdx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rTexIndex]));
gSPDisplayList(POLY_XLU_DISP++, this->gfx);
CLOSE_DISPS(gfxCtx, "../z_eff_ss_g_magma2.c", 311);
@@ -108,9 +108,9 @@ void EffectSsGMagma2_Update(PlayState* play, u32 index, EffectSs* this) {
if (this->rTimer >= 10) {
this->rTimer -= 10;
- this->rTexIdx++;
+ this->rTexIndex++;
- if (this->rTexIdx >= 10) {
+ if (this->rTexIndex >= 10) {
this->life = 0;
}
diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c
index aad2a21f5..0b7c5cdd9 100644
--- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c
+++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c
@@ -15,7 +15,7 @@
#define rEnvColorG regs[5]
#define rEnvColorB regs[6]
#define rEnvColorA regs[7]
-#define rTexIdx regs[8]
+#define rTexIndex regs[8]
#define rScale regs[9]
#define rScaleStep regs[10]
@@ -57,7 +57,7 @@ u32 EffectSsGSpk_Init(PlayState* play, u32 index, EffectSs* this, void* initPara
this->rEnvColorG = initParams->envColor.g;
this->rEnvColorB = initParams->envColor.b;
this->rEnvColorA = initParams->envColor.a;
- this->rTexIdx = 0;
+ this->rTexIndex = 0;
this->rScale = initParams->scale;
this->rScaleStep = initParams->scaleStep;
this->actor = initParams->actor;
@@ -76,7 +76,7 @@ void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this) {
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
- MtxF mfTrans11DA0;
+ MtxF mfTransBillboard;
Mtx* mtx;
f32 scale;
s32 pad;
@@ -86,14 +86,14 @@ void EffectSsGSpk_Draw(PlayState* play, u32 index, EffectSs* this) {
scale = this->rScale * 0.0025f;
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
if (mtx != NULL) {
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sparkTextures[this->rTexIdx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sparkTextures[this->rTexIndex]));
Gfx_SetupDL_60NoCDXlu(gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, 255);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA);
@@ -122,8 +122,8 @@ void EffectSsGSpk_Update(PlayState* play, u32 index, EffectSs* this) {
this->vec.x += this->accel.x;
this->vec.z += this->accel.z;
- this->rTexIdx++;
- this->rTexIdx &= 3;
+ this->rTexIndex++;
+ this->rTexIndex &= 3;
this->rScale += this->rScaleStep;
}
@@ -137,7 +137,7 @@ void EffectSsGSpk_UpdateNoAccel(PlayState* play, u32 index, EffectSs* this) {
}
}
- this->rTexIdx++;
- this->rTexIdx &= 3;
+ this->rTexIndex++;
+ this->rTexIndex &= 3;
this->rScale += this->rScaleStep;
}
diff --git a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c
index 75b11bd27..87e1ab519 100644
--- a/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c
+++ b/src/overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.c
@@ -7,7 +7,7 @@
#include "z_eff_ss_hitmark.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
-#define rTexIdx regs[0]
+#define rTexIndex regs[0]
#define rType regs[1]
#define rPrimColorR regs[2]
#define rPrimColorG regs[3]
@@ -56,7 +56,7 @@ u32 EffectSsHitMark_Init(PlayState* play, u32 index, EffectSs* this, void* initP
this->draw = EffectSsHitMark_Draw;
this->update = EffectSsHitMark_Update;
colorIdx = initParams->type * 4;
- this->rTexIdx = 0;
+ this->rTexIndex = 0;
this->rType = initParams->type;
this->rPrimColorR = sColors[colorIdx].r;
this->rPrimColorG = sColors[colorIdx].g;
@@ -74,7 +74,7 @@ void EffectSsHitMark_Draw(PlayState* play, u32 index, EffectSs* this) {
MtxF mfTrans;
MtxF mfScale;
MtxF mfResult;
- MtxF mfTrans11DA0;
+ MtxF mfTransBillboard;
Mtx* mtx;
f32 scale;
s32 pad;
@@ -84,15 +84,15 @@ void EffectSsHitMark_Draw(PlayState* play, u32 index, EffectSs* this) {
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
scale = this->rScale / 100.0f;
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
if (mtx != NULL) {
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[(this->rType * 8) + (this->rTexIdx)]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[(this->rType * 8) + (this->rTexIndex)]));
Gfx_SetupDL_61Xlu(gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, 255);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, 0);
@@ -105,18 +105,18 @@ void EffectSsHitMark_Update(PlayState* play, u32 index, EffectSs* this) {
s32 colorIdx;
if (this->rType == EFFECT_HITMARK_DUST) {
- this->rTexIdx = (15 - this->life) / 2;
+ this->rTexIndex = (15 - this->life) / 2;
} else {
- this->rTexIdx = 7 - this->life;
+ this->rTexIndex = 7 - this->life;
}
- if (this->rTexIdx != 0) {
+ if (this->rTexIndex != 0) {
colorIdx = this->rType * 4 + 2;
- this->rPrimColorR = func_80027DD4(this->rPrimColorR, sColors[colorIdx].r, this->life + 1);
- this->rPrimColorG = func_80027DD4(this->rPrimColorG, sColors[colorIdx].g, this->life + 1);
- this->rPrimColorB = func_80027DD4(this->rPrimColorB, sColors[colorIdx].b, this->life + 1);
- this->rEnvColorR = func_80027DD4(this->rEnvColorR, sColors[colorIdx + 1].r, this->life + 1);
- this->rEnvColorG = func_80027DD4(this->rEnvColorG, sColors[colorIdx + 1].g, this->life + 1);
- this->rEnvColorB = func_80027DD4(this->rEnvColorB, sColors[colorIdx + 1].b, this->life + 1);
+ this->rPrimColorR = EffectSs_LerpInv(this->rPrimColorR, sColors[colorIdx].r, this->life + 1);
+ this->rPrimColorG = EffectSs_LerpInv(this->rPrimColorG, sColors[colorIdx].g, this->life + 1);
+ this->rPrimColorB = EffectSs_LerpInv(this->rPrimColorB, sColors[colorIdx].b, this->life + 1);
+ this->rEnvColorR = EffectSs_LerpInv(this->rEnvColorR, sColors[colorIdx + 1].r, this->life + 1);
+ this->rEnvColorG = EffectSs_LerpInv(this->rEnvColorG, sColors[colorIdx + 1].g, this->life + 1);
+ this->rEnvColorB = EffectSs_LerpInv(this->rEnvColorB, sColors[colorIdx + 1].b, this->life + 1);
}
}
diff --git a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c
index 632072003..09f9e7917 100644
--- a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c
+++ b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c
@@ -81,8 +81,8 @@ void EffectSsKiraKira_Draw(PlayState* play, u32 index, EffectSs* this) {
MtxF mfTrans;
MtxF mfRotY;
MtxF mfScale;
- MtxF mfTrans11DA0;
- MtxF mfTrans11DA0RotY;
+ MtxF mfTransBillboard;
+ MtxF mfTransBillboardRotY;
MtxF mfResult;
Mtx* mtx;
@@ -94,9 +94,9 @@ void EffectSsKiraKira_Draw(PlayState* play, u32 index, EffectSs* this) {
SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z);
SkinMatrix_SetRotateZYX(&mfRotY, 0, 0, this->rYaw);
SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfRotY, &mfTrans11DA0RotY);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0RotY, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfRotY, &mfTransBillboardRotY);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboardRotY, &mfScale, &mfResult);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c
index 17c6c1260..14c5389e4 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c
@@ -76,8 +76,8 @@ void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this) {
MtxF mfTrans;
MtxF mfScale;
MtxF mfRotate;
- MtxF mfTrans11DA0;
- MtxF mfTrans11DA0Rotate;
+ MtxF mfTransBillboard;
+ MtxF mfTransBillboardRotate;
Mtx* mtx;
f32 yScale;
s16 texIdx;
@@ -96,9 +96,9 @@ void EffectSsLightning_Draw(PlayState* play, u32 index, EffectSs* this) {
xzScale = yScale * 0.6f;
SkinMatrix_SetScale(&mfScale, xzScale, yScale, xzScale);
SkinMatrix_SetRotateZYX(&mfRotate, this->vec.x, this->vec.y, this->rYaw);
- SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfRotate, &mfTrans11DA0Rotate);
- SkinMatrix_MtxFMtxFMult(&mfTrans11DA0Rotate, &mfScale, &mfResult);
+ SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfRotate, &mfTransBillboardRotate);
+ SkinMatrix_MtxFMtxFMult(&mfTransBillboardRotate, &mfScale, &mfResult);
gSPMatrix(POLY_XLU_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c
index 77ccaf49a..4225af82c 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki2/z_eff_ss_sibuki2.c
@@ -15,7 +15,7 @@
#define rEnvColorG regs[5]
#define rEnvColorB regs[6]
#define rEnvColorA regs[7]
-#define rTexIdx regs[8]
+#define rTexIndex regs[8]
#define rScale regs[9]
u32 EffectSsSibuki2_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx);
@@ -45,7 +45,7 @@ u32 EffectSsSibuki2_Init(PlayState* play, u32 index, EffectSs* this, void* initP
this->rEnvColorG = 100;
this->rEnvColorB = 100;
this->rEnvColorA = 255;
- this->rTexIdx = 0;
+ this->rTexIndex = 0;
return 1;
}
@@ -68,14 +68,14 @@ void EffectSsSibuki2_Draw(PlayState* play, u32 index, EffectSs* this) {
Gfx_SetupDL_25Opa(gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->rPrimColorR, this->rPrimColorG, this->rPrimColorB, this->rPrimColorA);
gDPSetEnvColor(POLY_XLU_DISP++, this->rEnvColorR, this->rEnvColorG, this->rEnvColorB, this->rEnvColorA);
- gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(bubbleTextures[this->rTexIdx]));
+ gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(bubbleTextures[this->rTexIndex]));
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gEffUnusedBubblesDL));
CLOSE_DISPS(gfxCtx, "../z_eff_ss_sibuki2.c", 198);
}
void EffectSsSibuki2_Update(PlayState* play, u32 index, EffectSs* this) {
- if (this->rTexIdx < 8) {
- this->rTexIdx++;
+ if (this->rTexIndex < 8) {
+ this->rTexIndex++;
}
}