From c4d302387fd7bf5e772b579d78c92d07dec4d030 Mon Sep 17 00:00:00 2001 From: Anghelo Date: Fri, 22 Jan 2021 13:37:22 -0300 Subject: [PATCH] Rename most members of the struct Signed-off-by: Anghelo --- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 184 +++++++++--------- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h | 12 +- 2 files changed, 98 insertions(+), 98 deletions(-) diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 678fcfa622..4cda3f24f7 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -50,14 +50,14 @@ void func_8099D8E0(EffDust *this) { s32 i; for (i = 0; i < 0x40; i++) { - this->unk_024C[i].z = 0.0f; - this->unk_024C[i].y = 0.0f; - this->unk_024C[i].x = 0.0f; + this->initialPositions[i].z = 0.0f; + this->initialPositions[i].y = 0.0f; + this->initialPositions[i].x = 0.0f; - this->unk_014C[i] = 1.0f; + this->distanceTraveled[i] = 1.0f; } - this->unk_054C = 0; + this->index = 0; } @@ -115,7 +115,7 @@ void EffDust_Init(Actor *thisx, GlobalContext *globalCtx) { } - this->unk_054D = 0xA; + this->life = 0xA; } @@ -127,34 +127,34 @@ void EffDust_UpdateFunc_8099DB28(EffDust *this, GlobalContext *globalCtx) { s16 theta; s16 fi; - f32 *unk_014C; + f32 *distanceTraveled; s32 i; s32 j; - unk_014C = this->unk_014C; + distanceTraveled = this->distanceTraveled; for (i = 0; i < 0x40; i++) { - if ((*unk_014C) < 1.0f) { - *unk_014C += 0.05f; + if ((*distanceTraveled) < 1.0f) { + *distanceTraveled += 0.05f; } - unk_014C++; + distanceTraveled++; // This won't match. - /*if (this->unk_014C[i] < 1.0f) { - this->unk_014C[i] += 0.05f; + /*if (this->distanceTraveled[i] < 1.0f) { + this->distanceTraveled[i] += 0.05f; }*/ } for (j = 0; j < 3; j++){ - i = this->unk_054C & 0x3F; - if (this->unk_014C[i] >= 1.0f) { + i = this->index & 0x3F; + if (this->distanceTraveled[i] >= 1.0f) { // Spherical coordinate system. fi = Rand_CenteredFloat(8192.0f); theta = Rand_CenteredFloat(4096.0f); - this->unk_024C[i].x = -800.0f * Math_CosS(fi) * Math_CosS(theta); - this->unk_024C[i].y = -800.0f * Math_SinS(theta); - this->unk_024C[i].z = -800.0f * Math_SinS(fi) * Math_CosS(theta); - this->unk_014C[i] = 0.0f; - this->unk_054C += 1; + this->initialPositions[i].x = -800.0f * Math_CosS(fi) * Math_CosS(theta); + this->initialPositions[i].y = -800.0f * Math_SinS(theta); + this->initialPositions[i].z = -800.0f * Math_SinS(fi) * Math_CosS(theta); + this->distanceTraveled[i] = 0.0f; + this->index += 1; } } } @@ -164,34 +164,34 @@ void EffDust_UpdateFunc_8099DD74(EffDust *this, GlobalContext *globalCtx) { s16 theta; s16 fi; - f32 *unk_014C; + f32 *distanceTraveled; s32 i; s32 j; - unk_014C = this->unk_014C; + distanceTraveled = this->distanceTraveled; for (i = 0; i < 0x40; i++) { - if ((*unk_014C) < 1.0f) { - *unk_014C += 0.03f; + if ((*distanceTraveled) < 1.0f) { + *distanceTraveled += 0.03f; } - unk_014C++; + distanceTraveled++; // This won't match. - /*if (this->unk_014C[i] < 1.0f) { - this->unk_014C[i] += 0.03f; + /*if (this->distanceTraveled[i] < 1.0f) { + this->distanceTraveled[i] += 0.03f; }*/ } for (j = 0; j < 2; j++){ - i = this->unk_054C & 0x3F; - if (this->unk_014C[i] >= 1.0f) { + i = this->index & 0x3F; + if (this->distanceTraveled[i] >= 1.0f) { // Spherical coordinate system. fi = Rand_CenteredFloat(65536.0f); theta = Rand_ZeroFloat(8192.0f); - this->unk_024C[i].x = 400.0f * Math_CosS(fi) * Math_CosS(theta); - this->unk_024C[i].y = 400.0f * Math_SinS(theta); - this->unk_024C[i].z = 400.0f * Math_SinS(fi) * Math_CosS(theta); - this->unk_014C[i] = 0.0f; - this->unk_054C += 1; + this->initialPositions[i].x = 400.0f * Math_CosS(fi) * Math_CosS(theta); + this->initialPositions[i].y = 400.0f * Math_SinS(theta); + this->initialPositions[i].z = 400.0f * Math_SinS(fi) * Math_CosS(theta); + this->distanceTraveled[i] = 0.0f; + this->index += 1; } } } @@ -203,7 +203,7 @@ void func_8099DFC0(EffDust *this, GlobalContext *globalCtx) { Player *player; Actor *parent; - f32 *unk_014C; + f32 *distanceTraveled; s32 i; s32 j; @@ -211,71 +211,71 @@ void func_8099DFC0(EffDust *this, GlobalContext *globalCtx) { player = PLAYER; parent = this->actor.parent; - unk_014C = this->unk_014C; + distanceTraveled = this->distanceTraveled; if(parent == NULL || parent->update == NULL || !(player->stateFlags1 & 0x1000)){ - if (this->unk_054D != 0) { - this->unk_054D -= 1; + if (this->life != 0) { + this->life -= 1; } else { Actor_Kill(&this->actor); } for (i = 0; i < 0x40; i++) { - if ((*unk_014C) < 1.0f) { - *unk_014C += 0.2f; + if ((*distanceTraveled) < 1.0f) { + *distanceTraveled += 0.2f; } - unk_014C++; + distanceTraveled++; } return; } for (i = 0; i < 0x40; i++) { - if ((*unk_014C) < 1.0f) { - *unk_014C += 0.1f; + if ((*distanceTraveled) < 1.0f) { + *distanceTraveled += 0.1f; } - unk_014C++; + distanceTraveled++; } this->actor.posRot.pos = parent->posRot.pos; for(j = 0; j < 3; j++){ - i = this->unk_054C & 0x3F; - if (this->unk_014C[i] >= 1.0f) { + i = this->index & 0x3F; + if (this->distanceTraveled[i] >= 1.0f) { theta = Rand_CenteredFloat(65536.0f); switch (this->actor.params) { case 2: - this->unk_024C[i].x = (Rand_ZeroOne() * 4500.0f) + 700.0f; - if (this->unk_024C[i].x > 3000.0f) { - this->unk_024C[i].y = (3000.0f * Rand_ZeroOne()) * Math_SinS(theta); - this->unk_024C[i].z = (3000.0f * Rand_ZeroOne()) * Math_CosS(theta); + this->initialPositions[i].x = (Rand_ZeroOne() * 4500.0f) + 700.0f; + if (this->initialPositions[i].x > 3000.0f) { + this->initialPositions[i].y = (3000.0f * Rand_ZeroOne()) * Math_SinS(theta); + this->initialPositions[i].z = (3000.0f * Rand_ZeroOne()) * Math_CosS(theta); } else { - this->unk_024C[i].y = 3000.0f * Math_SinS(theta); - this->unk_024C[i].z = 3000.0f * Math_CosS(theta); + this->initialPositions[i].y = 3000.0f * Math_SinS(theta); + this->initialPositions[i].z = 3000.0f * Math_CosS(theta); } break; case 3: - this->unk_024C[i].x = (Rand_ZeroOne() * 2500.0f) + 700.0f; - if (this->unk_024C[i].x > 2000.0f) { - this->unk_024C[i].y = (2000.0f * Rand_ZeroOne()) * Math_SinS(theta); - this->unk_024C[i].z = (2000.0f * Rand_ZeroOne()) * Math_CosS(theta); + this->initialPositions[i].x = (Rand_ZeroOne() * 2500.0f) + 700.0f; + if (this->initialPositions[i].x > 2000.0f) { + this->initialPositions[i].y = (2000.0f * Rand_ZeroOne()) * Math_SinS(theta); + this->initialPositions[i].z = (2000.0f * Rand_ZeroOne()) * Math_CosS(theta); } else { - this->unk_024C[i].y = 2000.0f * Math_SinS(theta); - this->unk_024C[i].z = 2000.0f * Math_CosS(theta); + this->initialPositions[i].y = 2000.0f * Math_SinS(theta); + this->initialPositions[i].z = 2000.0f * Math_CosS(theta); } break; case 4: - this->unk_024C[i].x = (Rand_ZeroOne() * 8500.0f) + 1700.0f; - if (this->unk_024C[i].x > 5000.0f) { - this->unk_024C[i].y = (4000.0f * Rand_ZeroOne()) * Math_SinS(theta); - this->unk_024C[i].z = (4000.0f * Rand_ZeroOne()) * Math_CosS(theta); + this->initialPositions[i].x = (Rand_ZeroOne() * 8500.0f) + 1700.0f; + if (this->initialPositions[i].x > 5000.0f) { + this->initialPositions[i].y = (4000.0f * Rand_ZeroOne()) * Math_SinS(theta); + this->initialPositions[i].z = (4000.0f * Rand_ZeroOne()) * Math_CosS(theta); } else { - this->unk_024C[i].y = 4000.0f * Math_SinS(theta); - this->unk_024C[i].z = 4000.0f * Math_CosS(theta); + this->initialPositions[i].y = 4000.0f * Math_SinS(theta); + this->initialPositions[i].z = 4000.0f * Math_CosS(theta); } break; @@ -283,8 +283,8 @@ void func_8099DFC0(EffDust *this, GlobalContext *globalCtx) { break; } - this->unk_014C[i] = 0.0f; - this->unk_054C += 1; + this->distanceTraveled[i] = 0.0f; + this->index += 1; } } } @@ -297,7 +297,7 @@ void EffDust_Update(Actor *thisx, GlobalContext *globalCtx) { #ifdef NON_MATCHING void func_8099E4F4(EffDust *this, GlobalContext *globalCtx) { - Vec3f *unk_024C; + Vec3f *initialPositions; f32 temp_f0; f32 dx; @@ -316,25 +316,25 @@ void func_8099E4F4(EffDust *this, GlobalContext *globalCtx) { gSPSegment(POLY_XLU_DISP++, 0x08, D_8099EB60); for (i = 0; i < 0x40; i++) { - if (this->unk_014C[i] < 1.0f) { + if (this->distanceTraveled[i] < 1.0f) { dx = this->dx; dy = this->dy; dz = this->dz; - temp_f0 = 1.0f - (this->unk_014C[i] * this->unk_014C[i]); + temp_f0 = 1.0f - (this->distanceTraveled[i] * this->distanceTraveled[i]); - unk_024C = &this->unk_024C[i]; + initialPositions = &this->initialPositions[i]; Matrix_Translate( - //this->actor.posRot.pos.x + (unk_024C->x * ((temp_f2 * temp_f0) + (1.0f - temp_f2))), - //this->actor.posRot.pos.x + (unk_024C->x * ((dx * temp_f0) + (1.0f - dx))), - this->actor.posRot.pos.x + (unk_024C->x * ((this->dx * temp_f0) + (1.0f - this->dx))), - //this->actor.posRot.pos.y + (unk_024C->y * ((temp_f16 * temp_f0) + (1.0f - temp_f16))), - //this->actor.posRot.pos.y + (unk_024C->y * ((dy * temp_f0) + (1.0f - dy))), - this->actor.posRot.pos.y + (unk_024C->y * ((this->dy * temp_f0) + (1.0f - this->dy))), - //this->actor.posRot.pos.z + (unk_024C->z * ((temp_f18 * temp_f0) + (1.0f - temp_f18))), - //this->actor.posRot.pos.z + (unk_024C->z * ((dz * temp_f0) + (1.0f - dz))), - this->actor.posRot.pos.z + (unk_024C->z * ((this->dz * temp_f0) + (1.0f - this->dz))), + //this->actor.posRot.pos.x + (initialPositions->x * ((temp_f2 * temp_f0) + (1.0f - temp_f2))), + //this->actor.posRot.pos.x + (initialPositions->x * ((dx * temp_f0) + (1.0f - dx))), + this->actor.posRot.pos.x + (initialPositions->x * ((this->dx * temp_f0) + (1.0f - this->dx))), + //this->actor.posRot.pos.y + (initialPositions->y * ((temp_f16 * temp_f0) + (1.0f - temp_f16))), + //this->actor.posRot.pos.y + (initialPositions->y * ((dy * temp_f0) + (1.0f - dy))), + this->actor.posRot.pos.y + (initialPositions->y * ((this->dy * temp_f0) + (1.0f - this->dy))), + //this->actor.posRot.pos.z + (initialPositions->z * ((temp_f18 * temp_f0) + (1.0f - temp_f18))), + //this->actor.posRot.pos.z + (initialPositions->z * ((dz * temp_f0) + (1.0f - dz))), + this->actor.posRot.pos.z + (initialPositions->z * ((this->dz * temp_f0) + (1.0f - this->dz))), MTXMODE_NEW ); @@ -359,8 +359,8 @@ void func_8099E784(EffDust *this, GlobalContext *globalCtx) { GlobalContext *glb_ctx; GraphicsContext *gfx_ctx; - f32 *unk_014C; - Vec3f *unk_024C; + f32 *distanceTraveled; + Vec3f *initialPositions; s32 i; f32 aux; @@ -385,31 +385,31 @@ void func_8099E784(EffDust *this, GlobalContext *globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0x00, 0x00, 0xFF, 0x00); } - unk_024C = this->unk_024C; - unk_014C = this->unk_014C; + initialPositions = this->initialPositions; + distanceTraveled = this->distanceTraveled; gSPSegment(POLY_XLU_DISP++, 0x08, D_8099EB60); for (i = 0; i < 0x40; i++) { - if (*unk_014C < 1.0f) { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0xFF, 0xFF, 0xFF, ((255.0f * (*unk_014C)))); + if (*distanceTraveled < 1.0f) { + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0xFF, 0xFF, 0xFF, ((255.0f * (*distanceTraveled)))); // TODO: find a way to match without needing to do this. this2 = this; if (!this2) { } - aux = 1.0f - (*unk_014C * *unk_014C); + aux = 1.0f - (*distanceTraveled * *distanceTraveled); Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); Matrix_Translate( - unk_024C->x * ((this2->dx * aux) + (1.0f - this2->dx)), - unk_024C->y * (1.0f - *unk_014C) + 320.0f, - unk_024C->z * (1.0f - *unk_014C) + -20.0f, + initialPositions->x * ((this2->dx * aux) + (1.0f - this2->dx)), + initialPositions->y * (1.0f - *distanceTraveled) + 320.0f, + initialPositions->z * (1.0f - *distanceTraveled) + -20.0f, MTXMODE_APPLY ); - Matrix_Scale(*unk_014C * this2->scalingFactor, *unk_014C * this2->scalingFactor, *unk_014C * this2->scalingFactor, MTXMODE_APPLY); + Matrix_Scale(*distanceTraveled * this2->scalingFactor, *distanceTraveled * this2->scalingFactor, *distanceTraveled * this2->scalingFactor, MTXMODE_APPLY); func_800D1FD4(&glb_ctx->mf_11DA0); @@ -417,8 +417,8 @@ void func_8099E784(EffDust *this, GlobalContext *globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(D_04037880)); } - unk_024C++; - unk_014C++; + initialPositions++; + distanceTraveled++; } CLOSE_DISPS(gfx_ctx, "../z_eff_dust.c", 515); diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h index 92501715ea..6394bdfa61 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h @@ -10,15 +10,15 @@ typedef void (*EffDustActionFunc)(struct EffDust *, GlobalContext *); typedef struct EffDust { /* 0x0000 */ Actor actor; - /* 0x014C */ f32 unk_014C[0x40]; - /* 0x024C */ Vec3f unk_024C[0x40]; // positions array (?) - /* 0x054C */ u8 unk_054C; // some type of counter :s - /* 0x054D */ u8 unk_054D; // life maybe (?) - /* 0x054E */ char padding[0x0002]; + /* 0x014C */ f32 distanceTraveled[0x40]; // normalized. 0.0f to 1.0f + /* 0x024C */ Vec3f initialPositions[0x40]; // array of position of each dust particle. + /* 0x054C */ u8 index; + /* 0x054D */ u8 life; // only considered if actor.params is 2, 3 or 4. + /* 0x054E */ char padding[0x02]; /* 0x0550 */ f32 dx; // x translate (?) /* 0x0554 */ f32 dy; // y translate (?) /* 0x0558 */ f32 dz; // z translate (?) - /* 0x055C */ f32 scalingFactor; // scaling factor (?) + /* 0x055C */ f32 scalingFactor; /* 0x0560 */ EffDustActionFunc updateFunc; // function to be called by EffDust_Update() /* 0x0560 */ EffDustActionFunc drawFunc; // function to be called by EffDust_Draw() } EffDust; // size = 0x0568