From 8f481b648d88a9a1346f2ac6d704f7a1e97d6dc8 Mon Sep 17 00:00:00 2001 From: cadmic Date: Fri, 2 Feb 2024 08:45:50 -0800 Subject: [PATCH] Match retail effects files in code (#1690) * Match code effects files * Poke jenkins --- src/code/z_eff_blure.c | 40 +++++++++++++++++--------------- src/code/z_eff_shield_particle.c | 7 +++--- src/code/z_eff_spark.c | 3 +-- src/code/z_effect_soft_sprite.c | 2 ++ 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index ca7d816bea..47722faaf8 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -4,16 +4,10 @@ void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { EffectBlureElement* elem; s32 numElements; - Vec3f sp16C; - Vec3f sp160; - Vec3f sp154; - f32 scale; - MtxF sp110; - MtxF spD0; - MtxF sp90; - MtxF sp50; - Vec3f sp44; - Vec3f sp38; + + // Necessary to match + if (this) {} + if (this) {} if (this != NULL) { numElements = this->numElements; @@ -34,6 +28,17 @@ void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { elem->p2.y = p2->y; elem->p2.z = p2->z; } else { + Vec3f sp16C; + Vec3f sp160; + Vec3f sp154; + f32 scale; + MtxF sp110; + MtxF spD0; + MtxF sp90; + MtxF sp50; + Vec3f sp44; + Vec3f sp38; + sp16C.x = ((f32)(elem - 1)->p2.x + (f32)(elem - 1)->p1.x) * 0.5f; sp16C.y = ((f32)(elem - 1)->p2.y + (f32)(elem - 1)->p1.y) * 0.5f; sp16C.z = ((f32)(elem - 1)->p2.z + (f32)(elem - 1)->p1.z) * 0.5f; @@ -255,19 +260,16 @@ void EffectBlure_UpdateFlags(EffectBlureElement* elem) { Vec3f sp58; Vec3f sp4C; Vec3f sp40; + EffectBlureElement* prev = elem - 1; + EffectBlureElement* next = elem + 1; + f32 sp34; + f32 sp30; + f32 sp2C; if (((elem - 1)->state == 0) || ((elem + 1)->state == 0)) { elem->flags &= ~3; elem->flags |= 2; } else { - EffectBlureElement* prev = elem - 1; - EffectBlureElement* next = elem + 1; - f32 sp34; - f32 sp30; - f32 sp2C; - - if (1) {} // Necessary to match - Math_Vec3s_DiffToVec3f(&sp64, &elem->p1, &prev->p1); Math_Vec3s_DiffToVec3f(&sp58, &elem->p2, &prev->p2); Math_Vec3s_DiffToVec3f(&sp4C, &next->p1, &elem->p1); @@ -1013,11 +1015,11 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { } } + flag = 0; j = 0; gSPVertex(POLY_XLU_DISP++, vtx, 32, 0); - flag = 0; for (i = 0; i < this->numElements; i++) { elem = &this->elements[i]; diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index d6df5282e5..b1e46cadd0 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -114,7 +114,6 @@ s32 EffectShieldParticle_Update(void* thisx) { void EffectShieldParticle_GetColors(EffectShieldParticle* this, Color_RGBA8* primColor, Color_RGBA8* envColor) { s32 halfDuration = this->duration * 0.5f; - f32 ratio; if (halfDuration == 0) { primColor->r = this->primColorStart.r; @@ -126,7 +125,8 @@ void EffectShieldParticle_GetColors(EffectShieldParticle* this, Color_RGBA8* pri envColor->b = this->envColorStart.b; envColor->a = this->envColorStart.a; } else if (this->timer < halfDuration) { - ratio = this->timer / (f32)halfDuration; + f32 ratio = this->timer / (f32)halfDuration; + primColor->r = this->primColorStart.r + (this->primColorMid.r - this->primColorStart.r) * ratio; primColor->g = this->primColorStart.g + (this->primColorMid.g - this->primColorStart.g) * ratio; primColor->b = this->primColorStart.b + (this->primColorMid.b - this->primColorStart.b) * ratio; @@ -136,7 +136,8 @@ void EffectShieldParticle_GetColors(EffectShieldParticle* this, Color_RGBA8* pri envColor->b = this->envColorStart.b + (this->envColorMid.b - this->envColorStart.b) * ratio; envColor->a = this->envColorStart.a + (this->envColorMid.a - this->envColorStart.a) * ratio; } else { - ratio = (this->timer - halfDuration) / (f32)halfDuration; + f32 ratio = (this->timer - halfDuration) / (f32)halfDuration; + primColor->r = this->primColorMid.r + (this->primColorEnd.r - this->primColorMid.r) * ratio; primColor->g = this->primColorMid.g + (this->primColorEnd.g - this->primColorMid.g) * ratio; primColor->b = this->primColorMid.b + (this->primColorEnd.b - this->primColorMid.b) * ratio; diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c index fdf91418a7..f741c0a138 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -5,7 +5,6 @@ void EffectSpark_Init(void* thisx, void* initParamsx) { EffectSpark* this = (EffectSpark*)thisx; EffectSparkInit* initParams = (EffectSparkInit*)initParamsx; - EffectSparkElement* elem; f32 velocityNorm; s32 i; @@ -61,7 +60,7 @@ void EffectSpark_Init(void* thisx, void* initParamsx) { } for (i = 0; i < this->numElements; i++) { - elem = &this->elements[i]; + EffectSparkElement* elem = &this->elements[i]; elem->position.x = this->position.x; elem->position.y = this->position.y; diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 6f4edc1596..c1ef1bb7af 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -8,11 +8,13 @@ void EffectSs_InitInfo(PlayState* play, s32 tableSize) { EffectSs* effectSs; EffectSsOverlay* overlay; +#if OOT_DEBUG for (i = 0; i < ARRAY_COUNT(gEffectSsOverlayTable); i++) { overlay = &gEffectSsOverlayTable[i]; PRINTF("effect index %3d:size=%6dbyte romsize=%6dbyte\n", i, (uintptr_t)overlay->vramEnd - (uintptr_t)overlay->vramStart, overlay->vromEnd - overlay->vromStart); } +#endif sEffectSsInfo.table = GAME_STATE_ALLOC(&play->state, tableSize * sizeof(EffectSs), "../z_effect_soft_sprite.c", 289);