diff --git a/include/z64.h b/include/z64.h index 6331a456a1..a7895b1865 100644 --- a/include/z64.h +++ b/include/z64.h @@ -705,7 +705,7 @@ typedef struct { /* 0xEC */ u8 unk_EC; /* 0xED */ u8 unk_ED; /* 0xEE */ u8 unk_EE[4]; - /* 0xF2 */ u8 unk_F2[8]; // [3] is used by both DemoKankyo and ObjectKankyo particle count + /* 0xF2 */ u8 unk_F2[8]; // [3] is used by both DemoKankyo and ObjectKankyo effect count /* 0xFA */ u8 unk_FA[4]; } EnvironmentContext; // size = 0x100 diff --git a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c index d064a3cb42..aae5930ed6 100644 --- a/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c +++ b/src/overlays/actors/ovl_Bg_Goron_Oyu/z_bg_goron_oyu.c @@ -20,7 +20,7 @@ void func_80B40100(BgGoronOyu* this, GlobalContext* globalCtx); void func_80B400C8(BgGoronOyu* this, GlobalContext* globalCtx); void func_80B401F8(BgGoronOyu* this, GlobalContext* globalCtx); void BgGoronOyu_UpdateWaterBoxInfo(BgGoronOyu* this, GlobalContext* globalCtx); -void BgGoronOyu_SpawnParticles(BgGoronOyu* this, GlobalContext* globalCtx); +void BgGoronOyu_SpawnEffects(BgGoronOyu* this, GlobalContext* globalCtx); void func_80B40160(BgGoronOyu* this, GlobalContext* globalCtx); const ActorInit Bg_Goron_Oyu_InitVars = { @@ -108,7 +108,7 @@ void BgGoronOyu_UpdateWaterBoxInfo(BgGoronOyu* this, GlobalContext* globalCtx) { } } -void BgGoronOyu_SpawnParticles(BgGoronOyu* this, GlobalContext* globalCtx) { +void BgGoronOyu_SpawnEffects(BgGoronOyu* this, GlobalContext* globalCtx) { s16 scale; Vec3f pos1; Vec3f pos2; @@ -178,7 +178,7 @@ void BgGoronOyu_Update(Actor* thisx, GlobalContext* globalCtx) { BgGoronOyu* this = THIS; this->actionFunc(this, globalCtx); - BgGoronOyu_SpawnParticles(this, globalCtx); + BgGoronOyu_SpawnEffects(this, globalCtx); } void BgGoronOyu_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h index 3b5882692f..3aa7d122a4 100644 --- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h +++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.h @@ -7,21 +7,23 @@ struct BossHakugin; typedef void (*BossHakuginActionFunc)(struct BossHakugin*, GlobalContext*); -typedef struct BossHakuginParticle { +typedef struct BossHakuginEffect { /* 0x00 */ Vec3f unk_0; /* 0x0C */ Vec3f unk_C; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; /* 0x1C */ Vec3s unk_1C; /* 0x24 */ f32 unk_24; -} BossHakuginParticle; // size = 0x28 +} BossHakuginEffect; // size = 0x28 + +#define BOSS_HAKUGIN_EFFECT_COUNT 180 typedef struct BossHakugin { /* 0x0000 */ Actor actor; /* 0x0144 */ char unk_0144[0x44]; /* 0x0188 */ BossHakuginActionFunc actionFunc; /* 0x018C */ char unk_018C[0x86C]; - /* 0x09F8 */ BossHakuginParticle unk_9F8[180]; + /* 0x09F8 */ BossHakuginEffect unk_9F8[BOSS_HAKUGIN_EFFECT_COUNT]; /* 0x2618 */ char unk_2618[0x11F8]; } BossHakugin; // size = 0x3810 diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 2c676abbfc..179d480de0 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -1,7 +1,7 @@ /* * File: z_demo_kankyo.c * Overlay: ovl_Demo_Kankyo - * Description: Background Lost Woods/Giant's Chamber/Moon Particles + * Description: Background Lost Woods/Giant's Chamber/Moon Effects */ #include "z_demo_kankyo.h" @@ -44,7 +44,7 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globa s32 pad; s32 i; f32 randSkyfishParticleNum; - f32 repositionLimit; // Distance from posCenter when particles are relocated. Always set to 130.0f + f32 repositionLimit; // Distance from posCenter when effects are relocated. Always set to 130.0f f32 eyeToAtNormX; f32 eyeToAtNormY; f32 eyeToAtNormZ; @@ -61,13 +61,13 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globa } else { Actor_MarkForDeath(&this->actor); } - } else if (globalCtx->envCtx.unk_F2[3] < DEMOKANKYO_PARTICLE_COUNT) { + } else if (globalCtx->envCtx.unk_F2[3] < DEMOKANKYO_EFFECT_COUNT) { globalCtx->envCtx.unk_F2[3] += 16; } // note: DemoKankyo can crash if placed in an area that snows (ObjectKankyo) - // because they both use unk_F2 as a particle counter, - // causing DemoKankyo to write beyond its particle array boundry + // because they both use unk_F2 as an effect counter, + // causing DemoKankyo to write beyond its efffect array boundry // this crash can occur if the two actors are in different scenes connected by an exit // e.g. if you add DemoKankyo to GoronShrine, you will crash entering/leaving through door for (i = 0; i < globalCtx->envCtx.unk_F2[3]; i++) { @@ -81,53 +81,53 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globa eyeToAtNormY = eyeToAt.y / eyeToAtMag; eyeToAtNormZ = eyeToAt.z / eyeToAtMag; - switch (this->particles[i].state) { + switch (this->effects[i].state) { case DEMO_KANKYO_STATE_INIT: - this->particles[i].posBase.x = globalCtx->view.eye.x + (eyeToAtNormX * 80.0f); - this->particles[i].posBase.y = globalCtx->view.eye.y + (eyeToAtNormY * 80.0f); - this->particles[i].posBase.z = globalCtx->view.eye.z + (eyeToAtNormZ * 80.0f); + this->effects[i].posBase.x = globalCtx->view.eye.x + (eyeToAtNormX * 80.0f); + this->effects[i].posBase.y = globalCtx->view.eye.y + (eyeToAtNormY * 80.0f); + this->effects[i].posBase.z = globalCtx->view.eye.z + (eyeToAtNormZ * 80.0f); - this->particles[i].posOffset.x = (Rand_ZeroOne() - 0.5f) * 160.0f; - this->particles[i].posOffset.y = 30.0f; - this->particles[i].posOffset.z = (Rand_ZeroOne() - 0.5f) * 160.0f; + this->effects[i].posOffset.x = (Rand_ZeroOne() - 0.5f) * 160.0f; + this->effects[i].posOffset.y = 30.0f; + this->effects[i].posOffset.z = (Rand_ZeroOne() - 0.5f) * 160.0f; - this->particles[i].speedTarget = (Rand_ZeroOne() * 1.6f) + 0.5f; - this->particles[i].alpha = 0; - this->particles[i].alphaClock = Rand_ZeroOne() * 65535; // random 0 to max of u16 - this->particles[i].scale = 0.1f; + this->effects[i].speedTarget = (Rand_ZeroOne() * 1.6f) + 0.5f; + this->effects[i].alpha = 0; + this->effects[i].alphaClock = Rand_ZeroOne() * 65535; // random 0 to max of u16 + this->effects[i].scale = 0.1f; // speedClock is angles in radians, // should have used Rand_ZeroOne() * 2 * M_PI // however, due to properties of sine waves, this is effectively still random - this->particles[i].speedClock.x = Rand_ZeroOne() * 360.0f; - this->particles[i].speedClock.y = Rand_ZeroOne() * 360.0f; - this->particles[i].speedClock.z = Rand_ZeroOne() * 360.0f; - this->particles[i].pad50 = 0; - this->particles[i].state += DEMO_KANKYO_STATE_SINGLE; + this->effects[i].speedClock.x = Rand_ZeroOne() * 360.0f; + this->effects[i].speedClock.y = Rand_ZeroOne() * 360.0f; + this->effects[i].speedClock.z = Rand_ZeroOne() * 360.0f; + this->effects[i].pad50 = 0; + this->effects[i].state += DEMO_KANKYO_STATE_SINGLE; break; case DEMO_KANKYO_STATE_SINGLE: case DEMO_KANKYO_STATE_SKYFISH: - this->particles[i].alphaClock++; + this->effects[i].alphaClock++; posCenterX = globalCtx->view.eye.x + (eyeToAtNormX * 80.0f); posCenterY = globalCtx->view.eye.y + (eyeToAtNormY * 80.0f); posCenterZ = globalCtx->view.eye.z + (eyeToAtNormZ * 80.0f); - this->particles[i].posOffsetPrev.x = this->particles[i].posOffset.x; - this->particles[i].posOffsetPrev.y = this->particles[i].posOffset.y; - this->particles[i].posOffsetPrev.z = this->particles[i].posOffset.z; + this->effects[i].posOffsetPrev.x = this->effects[i].posOffset.x; + this->effects[i].posOffsetPrev.y = this->effects[i].posOffset.y; + this->effects[i].posOffsetPrev.z = this->effects[i].posOffset.z; - if (this->particles[i].state == DEMO_KANKYO_STATE_SINGLE) { + if (this->effects[i].state == DEMO_KANKYO_STATE_SINGLE) { - // The first 32 particles will become skyfish particles + // The first 32 effects will become skyfish particles // This block is also init code and only runs once if (i < 32) { if (Rand_ZeroOne() < 0.5f) { - this->particles[i].LostWoodsSkyFishSpeedXZ = (s16)(Rand_ZeroOne() * 200.0f) + 200; + this->effects[i].LostWoodsSkyFishSpeedXZ = (s16)(Rand_ZeroOne() * 200.0f) + 200; } else { - this->particles[i].LostWoodsSkyFishSpeedXZ = -200 - (s16)(Rand_ZeroOne() * 200.0f); + this->effects[i].LostWoodsSkyFishSpeedXZ = -200 - (s16)(Rand_ZeroOne() * 200.0f); } - this->particles[i].LostWoodsSkyFishPosOffsetMax = (s16)(Rand_ZeroOne() * 50.0f) + 15; - this->particles[i].LostWoodsSkyFishSpeedY = ((Rand_ZeroOne() * 10.0f) + 10.0f) * 0.01f; + this->effects[i].LostWoodsSkyFishPosOffsetMax = (s16)(Rand_ZeroOne() * 50.0f) + 15; + this->effects[i].LostWoodsSkyFishSpeedY = ((Rand_ZeroOne() * 10.0f) + 10.0f) * 0.01f; // Only the 31st particle matters as sLostWoodsSkyFishParticleNum will be overwritten // every particle until the last skyfish particle is initialized @@ -145,147 +145,134 @@ void DemoKakyo_LostWoodsSparkleActionFunc(DemoKankyo* this, GlobalContext* globa if ((i & sLostWoodsSkyFishParticleNum) == 0) { // Head particle - this->particles[i].posOffset.y = 0.0f; + this->effects[i].posOffset.y = 0.0f; } - this->particles[i].state = DEMO_KANKYO_STATE_SKYFISH; - this->particles[i].speedTarget = 0.0f; + this->effects[i].state = DEMO_KANKYO_STATE_SKYFISH; + this->effects[i].speedTarget = 0.0f; } - Math_SmoothStepToF(&this->particles[i].scale, 0.1, 0.1f, 0.001f, 0.00001f); - Math_SmoothStepToF(&this->particles[i].speed, this->particles[i].speedTarget, 0.5f, 0.2f, 0.02f); - this->particles[i].posOffset.x += sinf(this->particles[i].speedClock.x) * this->particles[i].speed; - this->particles[i].posOffset.y += sinf(this->particles[i].speedClock.y) * this->particles[i].speed; - this->particles[i].posOffset.z += sinf(this->particles[i].speedClock.z) * this->particles[i].speed; + Math_SmoothStepToF(&this->effects[i].scale, 0.1, 0.1f, 0.001f, 0.00001f); + Math_SmoothStepToF(&this->effects[i].speed, this->effects[i].speedTarget, 0.5f, 0.2f, 0.02f); + this->effects[i].posOffset.x += sinf(this->effects[i].speedClock.x) * this->effects[i].speed; + this->effects[i].posOffset.y += sinf(this->effects[i].speedClock.y) * this->effects[i].speed; + this->effects[i].posOffset.z += sinf(this->effects[i].speedClock.z) * this->effects[i].speed; switch ((i >> 1) & 3) { case 0: - this->particles[i].speedClock.x += 0.008f; - this->particles[i].speedClock.y += 0.05f * Rand_ZeroOne(); - this->particles[i].speedClock.z += 0.015f; + this->effects[i].speedClock.x += 0.008f; + this->effects[i].speedClock.y += 0.05f * Rand_ZeroOne(); + this->effects[i].speedClock.z += 0.015f; break; case 1: - this->particles[i].speedClock.x += 0.01f * Rand_ZeroOne(); - this->particles[i].speedClock.y += 0.05f * Rand_ZeroOne(); - this->particles[i].speedClock.z += 0.005f * Rand_ZeroOne(); + this->effects[i].speedClock.x += 0.01f * Rand_ZeroOne(); + this->effects[i].speedClock.y += 0.05f * Rand_ZeroOne(); + this->effects[i].speedClock.z += 0.005f * Rand_ZeroOne(); break; case 2: - this->particles[i].speedClock.x += 0.01f * Rand_ZeroOne(); - this->particles[i].speedClock.y += 0.4f * Rand_ZeroOne(); - this->particles[i].speedClock.z += 0.004f * Rand_ZeroOne(); + this->effects[i].speedClock.x += 0.01f * Rand_ZeroOne(); + this->effects[i].speedClock.y += 0.4f * Rand_ZeroOne(); + this->effects[i].speedClock.z += 0.004f * Rand_ZeroOne(); break; case 3: - this->particles[i].speedClock.x += 0.01f * Rand_ZeroOne(); - this->particles[i].speedClock.y += 0.08f * Rand_ZeroOne(); - this->particles[i].speedClock.z += 0.05f * Rand_ZeroOne(); + this->effects[i].speedClock.x += 0.01f * Rand_ZeroOne(); + this->effects[i].speedClock.y += 0.08f * Rand_ZeroOne(); + this->effects[i].speedClock.z += 0.05f * Rand_ZeroOne(); break; } - } else if (this->particles[i].state == DEMO_KANKYO_STATE_SKYFISH) { + } else if (this->effects[i].state == DEMO_KANKYO_STATE_SKYFISH) { if ((i & sLostWoodsSkyFishParticleNum) == 0) { // Head particle - Math_SmoothStepToF(&this->particles[i].scale, 0.25f, 0.1f, 0.001f, 0.00001f); + Math_SmoothStepToF(&this->effects[i].scale, 0.25f, 0.1f, 0.001f, 0.00001f); - Math_SmoothStepToF(&this->particles[i].posBase.x, player->actor.world.pos.x, 0.5f, 1.0f, 0.2f); - Math_SmoothStepToF(&this->particles[i].posBase.y, player->actor.world.pos.y + 50.0f, 0.5f, 1.0f, + Math_SmoothStepToF(&this->effects[i].posBase.x, player->actor.world.pos.x, 0.5f, 1.0f, 0.2f); + Math_SmoothStepToF(&this->effects[i].posBase.y, player->actor.world.pos.y + 50.0f, 0.5f, 1.0f, 0.2f); - Math_SmoothStepToF(&this->particles[i].posBase.z, player->actor.world.pos.z, 0.5f, 1.0f, 0.2f); + Math_SmoothStepToF(&this->effects[i].posBase.z, player->actor.world.pos.z, 0.5f, 1.0f, 0.2f); - Math_SmoothStepToF(&this->particles[i].posOffset.x, - Math_SinS(this->particles[i].LostWoodsSkyFishSpeedXZClock - 0x8000) * - this->particles[i].LostWoodsSkyFishPosOffsetMax, + Math_SmoothStepToF(&this->effects[i].posOffset.x, + Math_SinS(this->effects[i].LostWoodsSkyFishSpeedXZClock - 0x8000) * + this->effects[i].LostWoodsSkyFishPosOffsetMax, 0.5f, 2.0f, 0.2f); - Math_SmoothStepToF(&this->particles[i].posOffset.z, - Math_CosS(this->particles[i].LostWoodsSkyFishSpeedXZClock - 0x8000) * - this->particles[i].LostWoodsSkyFishPosOffsetMax, + Math_SmoothStepToF(&this->effects[i].posOffset.z, + Math_CosS(this->effects[i].LostWoodsSkyFishSpeedXZClock - 0x8000) * + this->effects[i].LostWoodsSkyFishPosOffsetMax, 0.5f, 2.0f, 0.2f); - this->particles[i].LostWoodsSkyFishSpeedXZClock += this->particles[i].LostWoodsSkyFishSpeedXZ; - this->particles[i].posOffset.y += sinf(this->particles[i].speedClock.y); - this->particles[i].speedClock.x += 0.2f * Rand_ZeroOne(); // unused calculation - this->particles[i].speedClock.y += this->particles[i].LostWoodsSkyFishSpeedY; - this->particles[i].speedClock.z += 0.1f * Rand_ZeroOne(); // unused calculation + this->effects[i].LostWoodsSkyFishSpeedXZClock += this->effects[i].LostWoodsSkyFishSpeedXZ; + this->effects[i].posOffset.y += sinf(this->effects[i].speedClock.y); + this->effects[i].speedClock.x += 0.2f * Rand_ZeroOne(); // unused calculation + this->effects[i].speedClock.y += this->effects[i].LostWoodsSkyFishSpeedY; + this->effects[i].speedClock.z += 0.1f * Rand_ZeroOne(); // unused calculation - this->particles[i].posOffset.x = - Math_SinS(this->particles[i].LostWoodsSkyFishSpeedXZClock - 0x8000) * - this->particles[i].LostWoodsSkyFishPosOffsetMax; - this->particles[i].posOffset.z = - Math_CosS(this->particles[i].LostWoodsSkyFishSpeedXZClock - 0x8000) * - this->particles[i].LostWoodsSkyFishPosOffsetMax; + this->effects[i].posOffset.x = + Math_SinS(this->effects[i].LostWoodsSkyFishSpeedXZClock - 0x8000) * + this->effects[i].LostWoodsSkyFishPosOffsetMax; + this->effects[i].posOffset.z = + Math_CosS(this->effects[i].LostWoodsSkyFishSpeedXZClock - 0x8000) * + this->effects[i].LostWoodsSkyFishPosOffsetMax; } else { // Tail Particles - Math_SmoothStepToF(&this->particles[i].scale, 0.1, 0.1f, 0.001f, 0.00001f); + Math_SmoothStepToF(&this->effects[i].scale, 0.1, 0.1f, 0.001f, 0.00001f); // Unused calculation, speed only used in posOffset calculations, // but posOffset gets overwritten for tail particles immediately below - Math_SmoothStepToF(&this->particles[i].speed, 1.5f, 0.5f, 0.1f, 0.0002f); + Math_SmoothStepToF(&this->effects[i].speed, 1.5f, 0.5f, 0.1f, 0.0002f); // particles in the skyfish's tail are moved to the previous position of the particle directly // in front - this->particles[i].posOffset.x = - this->particles[i - 1].posOffsetPrev.x + - (this->particles[i - 1].posBase.x - this->particles[i].posBase.x); - this->particles[i].posOffset.y = - this->particles[i - 1].posOffsetPrev.y + - (this->particles[i - 1].posBase.y - this->particles[i].posBase.y); - this->particles[i].posOffset.z = - this->particles[i - 1].posOffsetPrev.z + - (this->particles[i - 1].posBase.z - this->particles[i].posBase.z); + this->effects[i].posOffset.x = this->effects[i - 1].posOffsetPrev.x + + (this->effects[i - 1].posBase.x - this->effects[i].posBase.x); + this->effects[i].posOffset.y = this->effects[i - 1].posOffsetPrev.y + + (this->effects[i - 1].posBase.y - this->effects[i].posBase.y); + this->effects[i].posOffset.z = this->effects[i - 1].posOffsetPrev.z + + (this->effects[i - 1].posBase.z - this->effects[i].posBase.z); } } - if ((this->particles[i].state != DEMO_KANKYO_STATE_SKYFISH) && - ((((this->particles[i].posBase.x + this->particles[i].posOffset.x) - posCenterX) > - repositionLimit) || - (((this->particles[i].posBase.x + this->particles[i].posOffset.x) - posCenterX) < - -repositionLimit) || - (((this->particles[i].posBase.y + this->particles[i].posOffset.y) - posCenterY) > - repositionLimit) || - (((this->particles[i].posBase.y + this->particles[i].posOffset.y) - posCenterY) < - -repositionLimit) || - (((this->particles[i].posBase.z + this->particles[i].posOffset.z) - posCenterZ) > - repositionLimit) || - (((this->particles[i].posBase.z + this->particles[i].posOffset.z) - posCenterZ) < - -repositionLimit))) { - if (((this->particles[i].posOffset.x + this->particles[i].posBase.x) - posCenterX) > - repositionLimit) { - this->particles[i].posOffset.x = 0.0f; - this->particles[i].posBase.x = posCenterX - repositionLimit; + if ((this->effects[i].state != DEMO_KANKYO_STATE_SKYFISH) && + ((((this->effects[i].posBase.x + this->effects[i].posOffset.x) - posCenterX) > repositionLimit) || + (((this->effects[i].posBase.x + this->effects[i].posOffset.x) - posCenterX) < -repositionLimit) || + (((this->effects[i].posBase.y + this->effects[i].posOffset.y) - posCenterY) > repositionLimit) || + (((this->effects[i].posBase.y + this->effects[i].posOffset.y) - posCenterY) < -repositionLimit) || + (((this->effects[i].posBase.z + this->effects[i].posOffset.z) - posCenterZ) > repositionLimit) || + (((this->effects[i].posBase.z + this->effects[i].posOffset.z) - posCenterZ) < -repositionLimit))) { + if (((this->effects[i].posOffset.x + this->effects[i].posBase.x) - posCenterX) > repositionLimit) { + this->effects[i].posOffset.x = 0.0f; + this->effects[i].posBase.x = posCenterX - repositionLimit; } - if (((this->particles[i].posBase.x + this->particles[i].posOffset.x) - posCenterX) < - -repositionLimit) { - this->particles[i].posOffset.x = 0.0f; - this->particles[i].posBase.x = posCenterX + repositionLimit; + if (((this->effects[i].posBase.x + this->effects[i].posOffset.x) - posCenterX) < -repositionLimit) { + this->effects[i].posOffset.x = 0.0f; + this->effects[i].posBase.x = posCenterX + repositionLimit; } - if (((this->particles[i].posBase.y + this->particles[i].posOffset.y) - posCenterY) > 50.0f) { - this->particles[i].posOffset.y = 0.0f; - this->particles[i].posBase.y = posCenterY - 50.0f; + if (((this->effects[i].posBase.y + this->effects[i].posOffset.y) - posCenterY) > 50.0f) { + this->effects[i].posOffset.y = 0.0f; + this->effects[i].posBase.y = posCenterY - 50.0f; } - if (((this->particles[i].posBase.y + this->particles[i].posOffset.y) - posCenterY) < -50.0f) { - this->particles[i].posOffset.y = 0.0f; - this->particles[i].posBase.y = posCenterY + 50.0f; + if (((this->effects[i].posBase.y + this->effects[i].posOffset.y) - posCenterY) < -50.0f) { + this->effects[i].posOffset.y = 0.0f; + this->effects[i].posBase.y = posCenterY + 50.0f; } - if (((this->particles[i].posBase.z + this->particles[i].posOffset.z) - posCenterZ) > - repositionLimit) { - this->particles[i].posOffset.z = 0.0f; - this->particles[i].posBase.z = posCenterZ - repositionLimit; + if (((this->effects[i].posBase.z + this->effects[i].posOffset.z) - posCenterZ) > repositionLimit) { + this->effects[i].posOffset.z = 0.0f; + this->effects[i].posBase.z = posCenterZ - repositionLimit; } - if (((this->particles[i].posBase.z + this->particles[i].posOffset.z) - posCenterZ) < - -repositionLimit) { - this->particles[i].posOffset.z = 0.0f; - this->particles[i].posBase.z = posCenterZ + repositionLimit; + if (((this->effects[i].posBase.z + this->effects[i].posOffset.z) - posCenterZ) < -repositionLimit) { + this->effects[i].posOffset.z = 0.0f; + this->effects[i].posBase.z = posCenterZ + repositionLimit; } } break; case DEMO_KANKYO_STATE_DISABLED: - this->particles[i].state = DEMO_KANKYO_STATE_INIT; + this->effects[i].state = DEMO_KANKYO_STATE_INIT; break; } } @@ -317,7 +304,7 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx s32 pad1; Vec3f worldPos; - if (globalCtx->envCtx.unk_F2[3] < DEMOKANKYO_PARTICLE_COUNT) { + if (globalCtx->envCtx.unk_F2[3] < DEMOKANKYO_EFFECT_COUNT) { globalCtx->envCtx.unk_F2[3] += 16; } @@ -332,38 +319,38 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx halfScreenHeight = SCREEN_HEIGHT / 2; for (i = 0; i < globalCtx->envCtx.unk_F2[3]; i++) { - switch (this->particles[i].state) { + switch (this->effects[i].state) { case DEMO_KANKYO_STATE_INIT: - this->particles[i].posBase.x = globalCtx->view.eye.x + (eyeToAtNormX * halfScreenHeight); - this->particles[i].posBase.y = globalCtx->view.eye.y + (eyeToAtNormY * halfScreenHeight); - this->particles[i].posBase.z = globalCtx->view.eye.z + (eyeToAtNormZ * halfScreenHeight); + this->effects[i].posBase.x = globalCtx->view.eye.x + (eyeToAtNormX * halfScreenHeight); + this->effects[i].posBase.y = globalCtx->view.eye.y + (eyeToAtNormY * halfScreenHeight); + this->effects[i].posBase.z = globalCtx->view.eye.z + (eyeToAtNormZ * halfScreenHeight); - this->particles[i].posOffset.x = (Rand_ZeroOne() - 0.5f) * (2.0f * halfScreenHeight); - this->particles[i].posOffset.y = (Rand_ZeroOne() - 0.5f) * (2.0f * halfScreenHeight); - this->particles[i].posOffset.z = (Rand_ZeroOne() - 0.5f) * (2.0f * halfScreenHeight); + this->effects[i].posOffset.x = (Rand_ZeroOne() - 0.5f) * (2.0f * halfScreenHeight); + this->effects[i].posOffset.y = (Rand_ZeroOne() - 0.5f) * (2.0f * halfScreenHeight); + this->effects[i].posOffset.z = (Rand_ZeroOne() - 0.5f) * (2.0f * halfScreenHeight); - this->particles[i].speedTarget = (Rand_ZeroOne() * 1.6f) + 0.5f; - this->particles[i].alpha = 0; - this->particles[i].alphaClock = (Rand_ZeroOne() * 65535); - this->particles[i].scale = 0.2f; + this->effects[i].speedTarget = (Rand_ZeroOne() * 1.6f) + 0.5f; + this->effects[i].alpha = 0; + this->effects[i].alphaClock = (Rand_ZeroOne() * 65535); + this->effects[i].scale = 0.2f; // speedClock is angles in radians, // should have used Rand_ZeroOne() * 2 * M_PI // however, due to properties of sine waves, this is effectively still random - this->particles[i].speedClock.x = Rand_ZeroOne() * 360.0f; - this->particles[i].speedClock.y = Rand_ZeroOne() * 360.0f; - this->particles[i].speedClock.z = Rand_ZeroOne() * 360.0f; + this->effects[i].speedClock.x = Rand_ZeroOne() * 360.0f; + this->effects[i].speedClock.y = Rand_ZeroOne() * 360.0f; + this->effects[i].speedClock.z = Rand_ZeroOne() * 360.0f; - this->particles[i].pad50 = 0; - this->particles[i].state += DEMO_KANKYO_STATE_SINGLE; + this->effects[i].pad50 = 0; + this->effects[i].state += DEMO_KANKYO_STATE_SINGLE; break; case DEMO_KANKYO_STATE_SINGLE: case DEMO_KANKYO_STATE_SKYFISH: - this->particles[i].alphaClock++; + this->effects[i].alphaClock++; if (this->actor.params == DEMO_KANKYO_TYPE_MOON) { // this function gets reused for giants too - this->particles[i].posBase.y = + this->effects[i].posBase.y = globalCtx->view.eye.y + (eyeToAtNormY * halfScreenHeight) + (SCREEN_HEIGHT / 3); } @@ -371,76 +358,76 @@ void DemoKakyo_MoonSparklesActionFunc(DemoKankyo* this, GlobalContext* globalCtx newEye.y = globalCtx->view.eye.y + (eyeToAtNormY * halfScreenHeight); newEye.z = globalCtx->view.eye.z + (eyeToAtNormZ * halfScreenHeight); - Math_SmoothStepToF(&this->particles[i].scale, 0.2f, 0.1f, 0.001f, 0.00001f); - Math_SmoothStepToF(&this->particles[i].speed, this->particles[i].speedTarget, 0.5f, 0.2f, 0.02f); + Math_SmoothStepToF(&this->effects[i].scale, 0.2f, 0.1f, 0.001f, 0.00001f); + Math_SmoothStepToF(&this->effects[i].speed, this->effects[i].speedTarget, 0.5f, 0.2f, 0.02f); - this->particles[i].posOffset.x += sinf(this->particles[i].speedClock.x) * this->particles[i].speed; - this->particles[i].posOffset.y += sinf(this->particles[i].speedClock.y) * this->particles[i].speed; - this->particles[i].posOffset.z += sinf(this->particles[i].speedClock.z) * this->particles[i].speed; + this->effects[i].posOffset.x += sinf(this->effects[i].speedClock.x) * this->effects[i].speed; + this->effects[i].posOffset.y += sinf(this->effects[i].speedClock.y) * this->effects[i].speed; + this->effects[i].posOffset.z += sinf(this->effects[i].speedClock.z) * this->effects[i].speed; switch ((i >> 1) & 3) { case 0: - this->particles[i].speedClock.x += 0.008f; - this->particles[i].speedClock.y += 0.05f * Rand_ZeroOne(); - this->particles[i].speedClock.z += 0.015f; + this->effects[i].speedClock.x += 0.008f; + this->effects[i].speedClock.y += 0.05f * Rand_ZeroOne(); + this->effects[i].speedClock.z += 0.015f; break; case 1: - this->particles[i].speedClock.x += 0.01f * Rand_ZeroOne(); - this->particles[i].speedClock.y += 0.05f * Rand_ZeroOne(); - this->particles[i].speedClock.z += 0.005f * Rand_ZeroOne(); + this->effects[i].speedClock.x += 0.01f * Rand_ZeroOne(); + this->effects[i].speedClock.y += 0.05f * Rand_ZeroOne(); + this->effects[i].speedClock.z += 0.005f * Rand_ZeroOne(); break; case 2: - this->particles[i].speedClock.x += 0.01f * Rand_ZeroOne(); - this->particles[i].speedClock.y += 0.4f * Rand_ZeroOne(); - this->particles[i].speedClock.z += 0.004f * Rand_ZeroOne(); + this->effects[i].speedClock.x += 0.01f * Rand_ZeroOne(); + this->effects[i].speedClock.y += 0.4f * Rand_ZeroOne(); + this->effects[i].speedClock.z += 0.004f * Rand_ZeroOne(); break; case 3: - this->particles[i].speedClock.x += 0.01f * Rand_ZeroOne(); - this->particles[i].speedClock.y += 0.08f * Rand_ZeroOne(); - this->particles[i].speedClock.z += 0.05f * Rand_ZeroOne(); + this->effects[i].speedClock.x += 0.01f * Rand_ZeroOne(); + this->effects[i].speedClock.y += 0.08f * Rand_ZeroOne(); + this->effects[i].speedClock.z += 0.05f * Rand_ZeroOne(); break; } - if (((this->particles[i].posBase.x + this->particles[i].posOffset.x) - newEye.x) > halfScreenHeight) { - this->particles[i].posBase.x = newEye.x - halfScreenHeight; + if (((this->effects[i].posBase.x + this->effects[i].posOffset.x) - newEye.x) > halfScreenHeight) { + this->effects[i].posBase.x = newEye.x - halfScreenHeight; } - if (((this->particles[i].posBase.x + this->particles[i].posOffset.x) - newEye.x) < -halfScreenHeight) { - this->particles[i].posBase.x = newEye.x + halfScreenHeight; + if (((this->effects[i].posBase.x + this->effects[i].posOffset.x) - newEye.x) < -halfScreenHeight) { + this->effects[i].posBase.x = newEye.x + halfScreenHeight; } - worldPos.x = this->particles[i].posBase.x + this->particles[i].posOffset.x; - worldPos.y = this->particles[i].posBase.y + this->particles[i].posOffset.y; - worldPos.z = this->particles[i].posBase.z + this->particles[i].posOffset.z; + worldPos.x = this->effects[i].posBase.x + this->effects[i].posOffset.x; + worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; + worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; randZeroOne = Math_Vec3f_DistXZ(&worldPos, &globalCtx->view.eye) / 200.0f; randZeroOne = CLAMP(randZeroOne, 0.0f, 1.0f); halfScreenWidth = 100.0f + randZeroOne + 60.0f; // range 160 to 161...? thats about half screen width - // I think this code is shifting the particles 1 frame -> half screen at a time to keep it in-view - if (halfScreenWidth < ((this->particles[i].posBase.y + this->particles[i].posOffset.y) - newEye.y)) { - this->particles[i].posBase.y = newEye.y - halfScreenWidth; + // I think this code is shifting the effects 1 frame -> half screen at a time to keep it in-view + if (halfScreenWidth < ((this->effects[i].posBase.y + this->effects[i].posOffset.y) - newEye.y)) { + this->effects[i].posBase.y = newEye.y - halfScreenWidth; } - if (((this->particles[i].posBase.y + this->particles[i].posOffset.y) - newEye.y) < -halfScreenWidth) { - this->particles[i].posBase.y = newEye.y + halfScreenWidth; + if (((this->effects[i].posBase.y + this->effects[i].posOffset.y) - newEye.y) < -halfScreenWidth) { + this->effects[i].posBase.y = newEye.y + halfScreenWidth; } - if (((this->particles[i].posBase.z + this->particles[i].posOffset.z) - newEye.z) > halfScreenHeight) { - this->particles[i].posBase.z = newEye.z - halfScreenHeight; + if (((this->effects[i].posBase.z + this->effects[i].posOffset.z) - newEye.z) > halfScreenHeight) { + this->effects[i].posBase.z = newEye.z - halfScreenHeight; } - if (((this->particles[i].posBase.z + this->particles[i].posOffset.z) - newEye.z) < -halfScreenHeight) { - this->particles[i].posBase.z = newEye.z + halfScreenHeight; + if (((this->effects[i].posBase.z + this->effects[i].posOffset.z) - newEye.z) < -halfScreenHeight) { + this->effects[i].posBase.z = newEye.z + halfScreenHeight; } break; case DEMO_KANKYO_STATE_DISABLED: - this->particles[i].state = DEMO_KANKYO_STATE_INIT; + this->effects[i].state = DEMO_KANKYO_STATE_INIT; break; } } @@ -454,7 +441,7 @@ void DemoKankyo_Init(Actor* thisx, GlobalContext* globalCtx) { // This must be a single line to match, possibly a macro? // clang-format off - for (i = 0; i < ARRAY_COUNT(this->particles); i++) { this->particles[i].state = DEMO_KANKYO_STATE_INIT; } + for (i = 0; i < ARRAY_COUNT(this->effects); i++) { this->effects[i].state = DEMO_KANKYO_STATE_INIT; } // clang-format on if (1) {}; @@ -524,9 +511,9 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, GlobalContext* globalCtx2) { gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_07AB10); for (i = 0; i < globalCtx->envCtx.unk_F2[3]; i++) { - worldPos.x = this->particles[i].posBase.x + this->particles[i].posOffset.x; - worldPos.y = this->particles[i].posBase.y + this->particles[i].posOffset.y; - worldPos.z = this->particles[i].posBase.z + this->particles[i].posOffset.z; + worldPos.x = this->effects[i].posBase.x + this->effects[i].posOffset.x; + worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; + worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; func_80169474(globalCtx, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT @@ -534,52 +521,52 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, GlobalContext* globalCtx2) { if (screenPos.x >= 0.0f && screenPos.x < SCREEN_WIDTH && screenPos.y >= 0.0f && screenPos.y < SCREEN_HEIGHT) { Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); - scaleAlpha = this->particles[i].alpha / 50.0f; + scaleAlpha = this->effects[i].alpha / 50.0f; if (scaleAlpha > 1.0f) { scaleAlpha = 1.0f; } - Matrix_Scale(this->particles[i].scale * scaleAlpha, this->particles[i].scale * scaleAlpha, - this->particles[i].scale * scaleAlpha, MTXMODE_APPLY); + Matrix_Scale(this->effects[i].scale * scaleAlpha, this->effects[i].scale * scaleAlpha, + this->effects[i].scale * scaleAlpha, MTXMODE_APPLY); // adjust transparency of this particle if (i < 32) { // Skyfish particles - if (this->particles[i].state != DEMO_KANKYO_STATE_SKYFISH) { + if (this->effects[i].state != DEMO_KANKYO_STATE_SKYFISH) { // still initializing - if (this->particles[i].alpha > 0) { // NOT DECR - this->particles[i].alpha--; + if (this->effects[i].alpha > 0) { // NOT DECR + this->effects[i].alpha--; } - } else if (this->particles[i].alpha < 100) { - this->particles[i].alpha++; + } else if (this->effects[i].alpha < 100) { + this->effects[i].alpha++; } - } else if (this->particles[i].state != DEMO_KANKYO_STATE_SKYFISH) { - if ((this->particles[i].alphaClock & 31) < 16) { - if (this->particles[i].alpha < 235) { - this->particles[i].alpha += 20; + } else if (this->effects[i].state != DEMO_KANKYO_STATE_SKYFISH) { + if ((this->effects[i].alphaClock & 31) < 16) { + if (this->effects[i].alpha < 235) { + this->effects[i].alpha += 20; } - } else if (this->particles[i].alpha > 20) { - this->particles[i].alpha -= 20; + } else if (this->effects[i].alpha > 20) { + this->effects[i].alpha -= 20; } - } else if ((this->particles[i].alphaClock & 15) < 8) { - if (this->particles[i].alpha < 255) { - this->particles[i].alpha += 100; + } else if ((this->effects[i].alphaClock & 15) < 8) { + if (this->effects[i].alpha < 255) { + this->effects[i].alpha += 100; } - } else if (this->particles[i].alpha > 10) { - this->particles[i].alpha -= 10; + } else if (this->effects[i].alpha > 10) { + this->effects[i].alpha -= 10; } gDPPipeSync(POLY_XLU_DISP++); switch (i & 1) { case 0: // gold particles - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 155, this->particles[i].alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 0, this->particles[i].alpha); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 155, this->effects[i].alpha); + gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 0, this->effects[i].alpha); break; case 1: // silver particles - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->particles[i].alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, this->particles[i].alpha); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->effects[i].alpha); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, this->effects[i].alpha); break; } @@ -613,42 +600,42 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, GlobalContext* globalCtx2) { func_8012C2DC(gfxCtx); for (i = 0; i < globalCtx->envCtx.unk_F2[3]; i++) { - worldPos.x = this->particles[i].posBase.x + this->particles[i].posOffset.x; - worldPos.y = this->particles[i].posBase.y + this->particles[i].posOffset.y; - worldPos.z = this->particles[i].posBase.z + this->particles[i].posOffset.z; + worldPos.x = this->effects[i].posBase.x + this->effects[i].posOffset.x; + worldPos.y = this->effects[i].posBase.y + this->effects[i].posOffset.y; + worldPos.z = this->effects[i].posBase.z + this->effects[i].posOffset.z; func_80169474(globalCtx, &worldPos, &screenPos); // unnamed Play_ function, func_800C016C from OoT - // checking if particle is on screen + // checking if effect is on screen if (screenPos.x >= 0.0f && screenPos.x < SCREEN_WIDTH && screenPos.y >= 0.0f && screenPos.y < SCREEN_HEIGHT) { Matrix_Translate(worldPos.x, worldPos.y, worldPos.z, MTXMODE_NEW); - alphaScale = this->particles[i].alpha / 50.0f; + alphaScale = this->effects[i].alpha / 50.0f; if (alphaScale > 1.0f) { alphaScale = 1.0f; } - Matrix_Scale(this->particles[i].scale * alphaScale, this->particles[i].scale * alphaScale, - this->particles[i].scale * alphaScale, MTXMODE_APPLY); + Matrix_Scale(this->effects[i].scale * alphaScale, this->effects[i].scale * alphaScale, + this->effects[i].scale * alphaScale, MTXMODE_APPLY); alphaScale = Math_Vec3f_DistXYZ(&worldPos, &globalCtx->view.eye) / 300.0f; alphaScale = CLAMP(1.0f - alphaScale, 0.0f, 1.0f); if (this->actor.params == DEMO_KANKYO_TYPE_GIANTS) { - this->particles[i].alpha = 255.0f * alphaScale; + this->effects[i].alpha = 255.0f * alphaScale; } else { - this->particles[i].alpha = 160.0f * alphaScale; + this->effects[i].alpha = 160.0f * alphaScale; } gDPPipeSync(POLY_XLU_DISP++); switch (i & 1) { // half/half slightly different shades of yellow/tan case 0: - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 220, this->particles[i].alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 230, 230, 30, this->particles[i].alpha); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 220, this->effects[i].alpha); + gDPSetEnvColor(POLY_XLU_DISP++, 230, 230, 30, this->effects[i].alpha); break; case 1: - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 200, 190, this->particles[i].alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 30, this->particles[i].alpha); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 200, 190, this->effects[i].alpha); + gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 30, this->effects[i].alpha); break; } diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h index d70616ed67..e614117eef 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h @@ -18,18 +18,18 @@ typedef struct { /* 0x03C */ u16 alphaClock; /* 0x03E */ u16 LostWoodsSkyFishSpeedXZClock; /* 0x040 */ u8 alpha; - /* 0x044 */ f32 scale; // size of the particle + /* 0x044 */ f32 scale; // size of the effect /* 0x048 */ u16 LostWoodsSkyFishSpeedXZ; // the x-z speed (angular velocity) the lost woods skyfish oscillates around player. pos or neg 200-400 /* 0x04A */ u16 LostWoodsSkyFishPosOffsetMax; // The x-z range the lost woods skyfish oscillates around player. random value between 15-65 /* 0x04C */ f32 LostWoodsSkyFishSpeedY; // the y speed (angular velocity) the lost woods skyfish oscillates around player. /* 0x050 */ u16 pad50; // unused, always assigned to 0, nothing else in this actor uses it -} DemoKankyoParticle; // size = 0x54 +} DemoKankyoEffect; // size = 0x54 -#define DEMOKANKYO_PARTICLE_COUNT 64 +#define DEMOKANKYO_EFFECT_COUNT 64 typedef struct DemoKankyo { /* 0x0000 */ Actor actor; - /* 0x0144 */ DemoKankyoParticle particles[DEMOKANKYO_PARTICLE_COUNT]; + /* 0x0144 */ DemoKankyoEffect effects[DEMOKANKYO_EFFECT_COUNT]; /* 0x1644 */ DemoKankyoActionFunc actionFunc; /* 0x1648 */ s32 objectId; /* 0x164C */ u8 isSafeToDrawGiants; diff --git a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c index 88fc110727..66ba49919a 100644 --- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c +++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c @@ -22,10 +22,9 @@ void EnBaguo_Roll(EnBaguo* this, GlobalContext* globalCtx); void EnBaguo_SetupRetreatUnderground(EnBaguo* this); void EnBaguo_RetreatUnderground(EnBaguo* this, GlobalContext* globalCtx); void EnBaguo_DrawBody(Actor* thisx, GlobalContext* globalCtx); -void EnBaguo_InitializeParticle(EnBaguo* this, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, - s16 timer); -void EnBaguo_UpdateParticles(EnBaguo* this, GlobalContext* globalCtx); -void EnBaguo_DrawRockParticles(EnBaguo* this, GlobalContext* globalCtx); +void EnBaguo_InitializeEffect(EnBaguo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 timer); +void EnBaguo_UpdateEffects(EnBaguo* this, GlobalContext* globalCtx); +void EnBaguo_DrawEffects(EnBaguo* this, GlobalContext* globalCtx); typedef enum { /* 0x0 */ NEJIRON_ACTION_INACTIVE, // The Nejiron is either underground or emerging from underground @@ -311,7 +310,7 @@ void EnBaguo_PostDetonation(EnBaguo* this, GlobalContext* globalCtx) { void EnBaguo_CheckForDetonation(EnBaguo* this, GlobalContext* globalCtx) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - Vec3f acceleration = { 0.0f, 0.0f, 0.0f }; + Vec3f accel = { 0.0f, 0.0f, 0.0f }; s32 i; // In order to match, this variable must act as both a boolean to check if @@ -335,15 +334,15 @@ void EnBaguo_CheckForDetonation(EnBaguo* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actor.shape.shadowScale = 0.0f; - for (i = 0; i < ARRAY_COUNT(this->particles); i++) { - acceleration.x = (Rand_ZeroOne() - 0.5f) * 8.0f; - acceleration.y = -1.0f; - acceleration.z = (Rand_ZeroOne() - 0.5f) * 8.0f; + for (i = 0; i < ARRAY_COUNT(this->effects); i++) { + accel.x = (Rand_ZeroOne() - 0.5f) * 8.0f; + accel.y = -1.0f; + accel.z = (Rand_ZeroOne() - 0.5f) * 8.0f; velocity.x = (Rand_ZeroOne() - 0.5f) * 14.0f; velocity.y = Rand_ZeroOne() * 30.0f; velocity.z = (Rand_ZeroOne() - 0.5f) * 14.0f; - EnBaguo_InitializeParticle(this, &this->actor.focus.pos, &velocity, &acceleration, - (Rand_ZeroFloat(1.0f) * 0.01f) + 0.003f, 90); + EnBaguo_InitializeEffect(this, &this->actor.focus.pos, &velocity, &accel, + (Rand_ZeroFloat(1.0f) * 0.01f) + 0.003f, 90); } Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, @@ -368,7 +367,7 @@ void EnBaguo_Update(Actor* thisx, GlobalContext* globalCtx) { EnBaguo* this = THIS; Actor_SetFocus(&this->actor, 30.0f); - EnBaguo_UpdateParticles(this, globalCtx); + EnBaguo_UpdateEffects(this, globalCtx); EnBaguo_CheckForDetonation(this, globalCtx); this->actionFunc(this, globalCtx); @@ -432,77 +431,76 @@ void EnBaguo_DrawBody(Actor* thisx, GlobalContext* globalCtx) { CLOSE_DISPS(globalCtx->state.gfxCtx); - EnBaguo_DrawRockParticles(this, globalCtx); + EnBaguo_DrawEffects(this, globalCtx); } -void EnBaguo_InitializeParticle(EnBaguo* this, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, - s16 timer) { +void EnBaguo_InitializeEffect(EnBaguo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 timer) { s16 i; - NejironParticle* particle = this->particles; + NejironEffect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (!particle->isVisible) { - particle->isVisible = true; - particle->position = *position; - particle->velocity = *velocity; - particle->acceleration = *acceleration; - particle->scale = scale; - particle->timer = timer; - particle->rotation.x = (s16)randPlusMinusPoint5Scaled(30000.0f); - particle->rotation.y = (s16)randPlusMinusPoint5Scaled(30000.0f); - particle->rotation.z = (s16)randPlusMinusPoint5Scaled(30000.0f); + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (!effect->isEnabled) { + effect->isEnabled = true; + effect->pos = *pos; + effect->velocity = *velocity; + effect->accel = *accel; + effect->scale = scale; + effect->timer = timer; + effect->rotation.x = (s16)randPlusMinusPoint5Scaled(30000.0f); + effect->rotation.y = (s16)randPlusMinusPoint5Scaled(30000.0f); + effect->rotation.z = (s16)randPlusMinusPoint5Scaled(30000.0f); return; } } } -void EnBaguo_UpdateParticles(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_UpdateEffects(EnBaguo* this, GlobalContext* globalCtx) { s32 i; - NejironParticle* particle = this->particles; + NejironEffect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (particle->isVisible) { - particle->position.x += particle->velocity.x; - particle->position.y += particle->velocity.y; - particle->position.z += particle->velocity.z; - particle->rotation.x += 0xBB8; - particle->rotation.y += 0xBB8; - particle->rotation.z += 0xBB8; - particle->velocity.x += particle->acceleration.x; - particle->velocity.y += particle->acceleration.y; - particle->velocity.z += particle->acceleration.z; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + effect->pos.x += effect->velocity.x; + effect->pos.y += effect->velocity.y; + effect->pos.z += effect->velocity.z; + effect->rotation.x += 0xBB8; + effect->rotation.y += 0xBB8; + effect->rotation.z += 0xBB8; + effect->velocity.x += effect->accel.x; + effect->velocity.y += effect->accel.y; + effect->velocity.z += effect->accel.z; - if (particle->position.y < (this->actor.world.pos.y - 10.0f)) { - Math_ApproachZeroF(&particle->scale, 0.2f, 0.001f); - if (particle->scale <= 0.0001f) { - particle->timer = 0; + if (effect->pos.y < (this->actor.world.pos.y - 10.0f)) { + Math_ApproachZeroF(&effect->scale, 0.2f, 0.001f); + if (effect->scale <= 0.0001f) { + effect->timer = 0; } } - if (particle->timer != 0) { - particle->timer--; + if (effect->timer != 0) { + effect->timer--; } else { - particle->isVisible = false; + effect->isEnabled = false; } } } } -void EnBaguo_DrawRockParticles(EnBaguo* this, GlobalContext* globalCtx) { +void EnBaguo_DrawEffects(EnBaguo* this, GlobalContext* globalCtx) { s16 i; - NejironParticle* particle = this->particles; + NejironEffect* effect = this->effects; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; OPEN_DISPS(gfxCtx); func_8012C28C(globalCtx->state.gfxCtx); - for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (particle->isVisible) { - Matrix_Translate(particle->position.x, particle->position.y, particle->position.z, MTXMODE_NEW); - Matrix_RotateXS(particle->rotation.x, MTXMODE_APPLY); - Matrix_RotateYS(particle->rotation.y, MTXMODE_APPLY); - Matrix_RotateZS(particle->rotation.z, MTXMODE_APPLY); - Matrix_Scale(particle->scale, particle->scale, particle->scale, MTXMODE_APPLY); + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_RotateXS(effect->rotation.x, MTXMODE_APPLY); + Matrix_RotateYS(effect->rotation.y, MTXMODE_APPLY); + Matrix_RotateZS(effect->rotation.z, MTXMODE_APPLY); + Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPSetPrimColor(POLY_OPA_DISP++, 0, 1, 255, 255, 255, 255); diff --git a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h index 133e68b3df..553a77f48f 100644 --- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h +++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h @@ -12,15 +12,17 @@ typedef void (*EnBaguoActionFunc)(struct EnBaguo*, GlobalContext*); * When a Nejiron explodes, rock particles fly out from where it exploded. * This struct governs how these rock particles behave. */ -typedef struct NejironParticle { - /* 0x00 */ u8 isVisible; - /* 0x04 */ Vec3f position; +typedef struct NejironEffect { + /* 0x00 */ u8 isEnabled; + /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f velocity; - /* 0x1C */ Vec3f acceleration; + /* 0x1C */ Vec3f accel; /* 0x28 */ Vec3s rotation; /* 0x30 */ f32 scale; /* 0x34 */ s16 timer; -} NejironParticle; // size = 0x38 +} NejironEffect; // size = 0x38 + +#define EN_BAGUO_EFFECT_COUNT 30 typedef struct EnBaguo { /* 0x000 */ Actor actor; @@ -39,7 +41,7 @@ typedef struct EnBaguo { /* 0x1D0 */ Vec3f targetRotation; /* 0x1DC */ ColliderJntSph collider; /* 0x1FC */ ColliderJntSphElement colliderElements[1]; - /* 0x23C */ NejironParticle particles[30]; + /* 0x23C */ NejironEffect effects[EN_BAGUO_EFFECT_COUNT]; } EnBaguo; // size = 0x8CC extern const ActorInit En_Baguo_InitVars; diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 0e3c9b20ae..c546ba7809 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -2700,10 +2700,10 @@ void EnBigslime_AddIceShardEffect(EnBigslime* this, GlobalContext* globalCtx) { iceShardEffect->pos.x = (targetVtx->n.ob[0] * this->actor.scale.x) + this->actor.world.pos.x; iceShardEffect->pos.y = (targetVtx->n.ob[1] * this->actor.scale.y) + this->actor.world.pos.y; iceShardEffect->pos.z = (targetVtx->n.ob[2] * this->actor.scale.z) + this->actor.world.pos.z; - iceShardEffect->rotation.x = (s32)Rand_Next() >> 0x10; - iceShardEffect->rotation.y = (s32)Rand_Next() >> 0x10; - iceShardEffect->rotation.z = (s32)Rand_Next() >> 0x10; - iceShardEffect->isActive = true; + iceShardEffect->rot.x = (s32)Rand_Next() >> 0x10; + iceShardEffect->rot.y = (s32)Rand_Next() >> 0x10; + iceShardEffect->rot.z = (s32)Rand_Next() >> 0x10; + iceShardEffect->isEnabled = true; randPitch = Rand_S16Offset(0x1000, 0x3000); vtxZ = targetVtx->n.ob[2]; vtxX = targetVtx->n.ob[0]; @@ -2715,9 +2715,9 @@ void EnBigslime_AddIceShardEffect(EnBigslime* this, GlobalContext* globalCtx) { xzDist = Math_CosS(randPitch) * randFloat; } - iceShardEffect->vel.x = targetVtx->n.ob[0] * xzDist; - iceShardEffect->vel.y = Math_SinS(randPitch) * randFloat; - iceShardEffect->vel.z = targetVtx->n.ob[2] * xzDist; + iceShardEffect->velocity.x = targetVtx->n.ob[0] * xzDist; + iceShardEffect->velocity.y = Math_SinS(randPitch) * randFloat; + iceShardEffect->velocity.z = targetVtx->n.ob[2] * xzDist; iceShardEffect->scale = 0.001f * (Rand_ZeroFloat(6.0f) + 2.0f); } } @@ -2736,15 +2736,15 @@ void EnBigslime_UpdateEffects(EnBigslime* this) { // Update ice shards for (i = 0; i < BIGSLIME_NUM_ICE_SHARD; i++) { iceShardEffect = &this->iceShardEffect[i]; - if (iceShardEffect->isActive > false) { - iceShardEffect->vel.y += -1.0f; - Math_Vec3f_Sum(&iceShardEffect->pos, &iceShardEffect->vel, &iceShardEffect->pos); + if (iceShardEffect->isEnabled > false) { + iceShardEffect->velocity.y += -1.0f; + Math_Vec3f_Sum(&iceShardEffect->pos, &iceShardEffect->velocity, &iceShardEffect->pos); if (iceShardEffect->pos.y < (GBT_ROOM_5_MIN_Y - 20.0f)) { - iceShardEffect->isActive = false; + iceShardEffect->isEnabled = false; } - iceShardEffect->rotation.x += (s16)((Rand_Next() >> 0x17) + 0x700); - iceShardEffect->rotation.y += (s16)((Rand_Next() >> 0x17) + 0x900); - iceShardEffect->rotation.z += (s16)((Rand_Next() >> 0x17) + 0xB00); + iceShardEffect->rot.x += (s16)((Rand_Next() >> 0x17) + 0x700); + iceShardEffect->rot.y += (s16)((Rand_Next() >> 0x17) + 0x900); + iceShardEffect->rot.z += (s16)((Rand_Next() >> 0x17) + 0xB00); } } @@ -3143,9 +3143,9 @@ void EnBigslime_DrawShatteringEffects(EnBigslime* this, GlobalContext* globalCtx for (i = 0; i < BIGSLIME_NUM_ICE_SHARD; i++) { iceShardEffect = &this->iceShardEffect[i]; - if (iceShardEffect->isActive > false) { + if (iceShardEffect->isEnabled > false) { Matrix_SetTranslateRotateYXZ(iceShardEffect->pos.x, iceShardEffect->pos.y, iceShardEffect->pos.z, - &iceShardEffect->rotation); + &iceShardEffect->rot); Matrix_Scale(iceShardEffect->scale, iceShardEffect->scale, iceShardEffect->scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h index 579ec5d509..1005ccff5f 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h @@ -42,9 +42,9 @@ typedef struct { typedef struct { /* 0x00 */ Vec3f pos; - /* 0x0C */ Vec3f vel; - /* 0x18 */ s16 isActive; - /* 0x1A */ Vec3s rotation; + /* 0x0C */ Vec3f velocity; + /* 0x18 */ s16 isEnabled; + /* 0x1A */ Vec3s rot; /* 0x20 */ f32 scale; } EnBigslimeIceShardEffect; // size = 0x24 diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 9b089d836c..dd20b9a250 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -114,7 +114,7 @@ static TexturePtr sWaterSplashTextures[] = { * Creates a debris effect. * Debris effects are spawned by an explosion. */ -void EnClearTag_CreateDebrisEffect(EnClearTag* this, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, +void EnClearTag_CreateDebrisEffect(EnClearTag* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, f32 rotationZ) { EnClearTagEffect* effect = this->effect; s16 i; @@ -124,9 +124,9 @@ void EnClearTag_CreateDebrisEffect(EnClearTag* this, Vec3f* position, Vec3f* vel if (effect->type == CLEAR_TAG_EFFECT_AVAILABLE) { effect->type = CLEAR_TAG_EFFECT_DEBRIS; - effect->position = *position; + effect->pos = *pos; effect->velocity = *velocity; - effect->acceleration = *acceleration; + effect->accel = *accel; effect->scale = scale; @@ -149,7 +149,7 @@ void EnClearTag_CreateDebrisEffect(EnClearTag* this, Vec3f* position, Vec3f* vel * Creates a smoke effect. * Smoke effects are spawned by an explosion. */ -void EnClearTag_CreateSmokeEffect(EnClearTag* this, Vec3f* position, f32 scale) { +void EnClearTag_CreateSmokeEffect(EnClearTag* this, Vec3f* pos, f32 scale) { s16 i; EnClearTagEffect* effect = this->effect; @@ -159,9 +159,9 @@ void EnClearTag_CreateSmokeEffect(EnClearTag* this, Vec3f* position, f32 scale) effect->actionTimer = Rand_ZeroFloat(100.0f); effect->type = CLEAR_TAG_EFFECT_SMOKE; - effect->position = *position; + effect->pos = *pos; effect->velocity = sZeroVector; - effect->acceleration = sZeroVector; + effect->accel = sZeroVector; effect->scale = scale; effect->maxScale = 2.0f * scale; @@ -185,7 +185,7 @@ void EnClearTag_CreateSmokeEffect(EnClearTag* this, Vec3f* position, f32 scale) * Creates an isolated smoke effect without an explosion. * Smoke effects are spawned directly. */ -void EnClearTag_CreateIsolatedSmokeEffect(EnClearTag* this, Vec3f* position, f32 scale) { +void EnClearTag_CreateIsolatedSmokeEffect(EnClearTag* this, Vec3f* pos, f32 scale) { s16 i; EnClearTagEffect* effect = this->effect; @@ -195,9 +195,9 @@ void EnClearTag_CreateIsolatedSmokeEffect(EnClearTag* this, Vec3f* position, f32 effect->actionTimer = Rand_ZeroFloat(100.0f); effect->type = CLEAR_TAG_EFFECT_ISOLATED_SMOKE; - effect->position = *position; + effect->pos = *pos; effect->velocity = sZeroVector; - effect->acceleration = sZeroVector; + effect->accel = sZeroVector; effect->scale = scale; effect->maxScale = 2.0f * scale; @@ -229,7 +229,7 @@ void EnClearTag_CreateIsolatedSmokeEffect(EnClearTag* this, Vec3f* position, f32 * Flash effects are spawned by an explosion or a pop. * Flash effects have two components: 1) a billboard flash, and 2) a light effect on the ground. */ -void EnClearTag_CreateFlashEffect(EnClearTag* this, Vec3f* position, f32 scale, f32 floorHeight) { +void EnClearTag_CreateFlashEffect(EnClearTag* this, Vec3f* pos, f32 scale, f32 floorHeight) { EnClearTagEffect* effect = this->effect; s16 i; @@ -238,9 +238,9 @@ void EnClearTag_CreateFlashEffect(EnClearTag* this, Vec3f* position, f32 scale, if (effect->type == CLEAR_TAG_EFFECT_AVAILABLE) { effect->type = CLEAR_TAG_EFFECT_FLASH; - effect->position = *position; + effect->pos = *pos; effect->velocity = sZeroVector; - effect->acceleration = sZeroVector; + effect->accel = sZeroVector; effect->scale = 0.0f; effect->maxScale = scale * 3.0f; @@ -259,7 +259,7 @@ void EnClearTag_CreateFlashEffect(EnClearTag* this, Vec3f* position, f32 scale, * Creates a light ray effect. * Light ray effects are spawned by an explosion or pop. */ -void EnClearTag_CreateLightRayEffect(EnClearTag* this, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, +void EnClearTag_CreateLightRayEffect(EnClearTag* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, f32 maxScaleTarget, s16 alphaDecrementSpeed) { EnClearTagEffect* effect = this->effect; s16 i; @@ -271,9 +271,9 @@ void EnClearTag_CreateLightRayEffect(EnClearTag* this, Vec3f* position, Vec3f* v effect->type = CLEAR_TAG_EFFECT_LIGHT_RAYS; - effect->position = *position; + effect->pos = *pos; effect->velocity = *velocity; - effect->acceleration = *acceleration; + effect->accel = *accel; effect->scale = scale / 1000.0f; effect->maxScale = 1.0f; @@ -303,8 +303,8 @@ void EnClearTag_CreateLightRayEffect(EnClearTag* this, Vec3f* position, Vec3f* v * Creates an isolated light ray effect without an explosion or pop. * Light ray effects are spawned directly. */ -void EnClearTag_CreateIsolatedLightRayEffect(EnClearTag* this, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, - f32 scale, f32 maxScaleTarget, s16 colorIndex, s16 alphaDecrementSpeed) { +void EnClearTag_CreateIsolatedLightRayEffect(EnClearTag* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, + f32 maxScaleTarget, s16 colorIndex, s16 alphaDecrementSpeed) { EnClearTagEffect* effect = this->effect; s16 i; @@ -313,9 +313,9 @@ void EnClearTag_CreateIsolatedLightRayEffect(EnClearTag* this, Vec3f* position, if (effect->type == CLEAR_TAG_EFFECT_AVAILABLE) { effect->type = CLEAR_TAG_EFFECT_LIGHT_RAYS; - effect->position = *position; + effect->pos = *pos; effect->velocity = *velocity; - effect->acceleration = *acceleration; + effect->accel = *accel; effect->scale = scale / 1000.0f; effect->maxScale = 1.0f; @@ -345,7 +345,7 @@ void EnClearTag_CreateIsolatedLightRayEffect(EnClearTag* this, Vec3f* position, * Creates a shockwave effect * This effect uses concentric ring floor shadows that travel radially outward along the floor poly */ -void EnClearTag_CreateShockwaveEffect(EnClearTag* this, Vec3f* position, f32 maxScale, s16 actionTimer) { +void EnClearTag_CreateShockwaveEffect(EnClearTag* this, Vec3f* pos, f32 maxScale, s16 actionTimer) { EnClearTagEffect* effect = this->effect; s16 i; @@ -354,9 +354,9 @@ void EnClearTag_CreateShockwaveEffect(EnClearTag* this, Vec3f* position, f32 max if (effect->type == CLEAR_TAG_EFFECT_AVAILABLE) { effect->type = CLEAR_TAG_EFFECT_SHOCKWAVE; - effect->position = *position; + effect->pos = *pos; effect->velocity = sZeroVector; - effect->acceleration = sZeroVector; + effect->accel = sZeroVector; effect->maxScale = maxScale; effect->scale = 0.0f; @@ -374,7 +374,7 @@ void EnClearTag_CreateShockwaveEffect(EnClearTag* this, Vec3f* position, f32 max * Creates a splash effect * This effect is used when EnClearTag is spawned above a waterbox */ -void EnClearTag_CreateSplashEffect(EnClearTag* this, Vec3f* position, s16 effectsTimer) { +void EnClearTag_CreateSplashEffect(EnClearTag* this, Vec3f* pos, s16 effectsTimer) { s16 i; EnClearTagEffect* effect = this->effect; @@ -385,9 +385,9 @@ void EnClearTag_CreateSplashEffect(EnClearTag* this, Vec3f* position, s16 effect effect->actionTimer = Rand_ZeroFloat(100.0f); effect->type = CLEAR_TAG_EFFECT_SPLASH; - effect->position = *position; + effect->pos = *pos; effect->velocity = sZeroVector; - effect->acceleration = sZeroVector; + effect->accel = sZeroVector; effect->scale = 0.0f; effect->maxScale = 0.0f; @@ -645,13 +645,13 @@ void EnClearTag_UpdateEffects(EnClearTag* this, GlobalContext* globalCtx) { effect->actionTimer++; // Perform effect physics. - effect->position.x += effect->velocity.x; - originalYPosition = effect->position.y; - effect->position.y += effect->velocity.y; - effect->position.z += effect->velocity.z; - effect->velocity.x += effect->acceleration.x; - effect->velocity.y += effect->acceleration.y; - effect->velocity.z += effect->acceleration.z; + effect->pos.x += effect->velocity.x; + originalYPosition = effect->pos.y; + effect->pos.y += effect->velocity.y; + effect->pos.z += effect->velocity.z; + effect->velocity.x += effect->accel.x; + effect->velocity.y += effect->accel.y; + effect->velocity.z += effect->accel.z; if (effect->type == CLEAR_TAG_EFFECT_DEBRIS) { // Clamp the velocity to -5.0 @@ -661,12 +661,12 @@ void EnClearTag_UpdateEffects(EnClearTag* this, GlobalContext* globalCtx) { // While the effect is falling check if it has hit the ground. if (effect->velocity.y < 0.0f) { - sphereCenter = effect->position; + sphereCenter = effect->pos; sphereCenter.y += 5.0f; // Check if the debris has hit the ground. if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &sphereCenter, 11.0f)) { - effect->position.y = originalYPosition; + effect->pos.y = originalYPosition; // Bounce the debris effect. if (effect->bounces <= 0) { @@ -675,14 +675,13 @@ void EnClearTag_UpdateEffects(EnClearTag* this, GlobalContext* globalCtx) { effect->effectsTimer = Rand_ZeroFloat(20.0f) + 25.0f; } else { // The Debris effect is done bouncing. Set its velocity and acceleration to 0. - effect->velocity.x = effect->velocity.z = effect->acceleration.y = effect->velocity.y = - 0.0f; + effect->velocity.x = effect->velocity.z = effect->accel.y = effect->velocity.y = 0.0f; } } } // Rotate the debris effect. - if (effect->acceleration.y != 0.0f) { + if (effect->accel.y != 0.0f) { effect->rotationY += 0.5f; effect->rotationX += 0.35f; } @@ -821,7 +820,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { } // Draw the debris effect. - Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); Matrix_RotateYF(effect->rotationY, MTXMODE_APPLY); Matrix_RotateXFApply(effect->rotationX); @@ -839,7 +838,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, (s8)effect->primColor.a); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)effect->primColor.a); - func_800C0094(this->actor.floorPoly, effect->position.x, effect->position.y, effect->position.z, &mtxF); + func_800C0094(this->actor.floorPoly, effect->pos.x, effect->pos.y, effect->pos.z, &mtxF); Matrix_Put(&mtxF); Matrix_Scale(effect->scale, 1.0f, effect->scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -863,8 +862,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { // Draw the ground flash effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (s8)(effect->primColor.a * 0.7f)); - func_800C0094(this->actor.floorPoly, effect->position.x, this->actor.floorHeight, effect->position.z, - &mtxF); + func_800C0094(this->actor.floorPoly, effect->pos.x, this->actor.floorHeight, effect->pos.z, &mtxF); Matrix_Put(&mtxF); Matrix_Scale(effect->scale * 3.0f, 1.0f, effect->scale * 3.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -893,7 +891,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { gSPSegment( POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -effect->actionTimer * 5, 32, 64, 1, 0, 0, 32, 32)); - Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->smokeScaleX * effect->scale, effect->smokeScaleY * effect->scale, 1.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, 20.0f, 0.0f, MTXMODE_APPLY); @@ -919,7 +917,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { gSPSegment( POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -effect->actionTimer * 15, 32, 64, 1, 0, 0, 32, 32)); - Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -941,7 +939,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { // Draw the flash billboard effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (s8)effect->primColor.a); - Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(2.0f * effect->scale, 2.0f * effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -966,7 +964,7 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { // Draw the light ray effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (u8)effect->primColor.r, (u8)effect->primColor.g, (u8)effect->primColor.b, (u8)effect->primColor.a); - Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_RotateYF(effect->rotationY, MTXMODE_APPLY); Matrix_RotateXFApply(effect->rotationX); Matrix_RotateZF(effect->rotationZ, MTXMODE_APPLY); @@ -998,12 +996,12 @@ void EnClearTag_DrawEffects(Actor* thisx, GlobalContext* globalCtx) { * returns true if point is within the xz boundaries of an active water box, else false * `ySurface` returns the water box's surface, while `outWaterBox` returns a pointer to the WaterBox */ - ySurface = effect->position.y; - if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, effect->position.x + vec.x, - effect->position.z + vec.z, &ySurface, &waterBox)) { - if ((effect->position.y - ySurface) < 200.0f) { + ySurface = effect->pos.y; + if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, effect->pos.x + vec.x, effect->pos.z + vec.z, + &ySurface, &waterBox)) { + if ((effect->pos.y - ySurface) < 200.0f) { // Draw the splash effect. - Matrix_Translate(effect->position.x + vec.x, ySurface, effect->position.z + vec.z, MTXMODE_NEW); + Matrix_Translate(effect->pos.x + vec.x, ySurface, effect->pos.z + vec.z, MTXMODE_NEW); Matrix_RotateYF(2.0f * (j * M_PI) * (1.0f / 16.0f), MTXMODE_APPLY); Matrix_RotateXFApply(effect->rotationX); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h index a2d188cba8..c14cc36fdd 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h @@ -8,9 +8,9 @@ struct EnClearTag; typedef struct EnClearTagEffect { /* 0x00 */ u8 type; /* 0x01 */ u8 actionTimer; - /* 0x04 */ Vec3f position; + /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f velocity; - /* 0x1C */ Vec3f acceleration; + /* 0x1C */ Vec3f accel; /* 0x28 */ Color_RGBAf primColor; /* 0x38 */ Color_RGBAf envColor; /* 0x48 */ s16 bounces; @@ -27,9 +27,11 @@ typedef struct EnClearTagEffect { /* 0x6C */ f32 smokeScaleX; } EnClearTagEffect; // size = 0x70 +#define EN_CLEAR_TAG_EFFECT_COUNT 103 + typedef struct EnClearTag { /* 0x0000 */ Actor actor; - /* 0x0144 */ EnClearTagEffect effect[103]; + /* 0x0144 */ EnClearTagEffect effect[EN_CLEAR_TAG_EFFECT_COUNT]; /* 0x2E54 */ u8 cameraState; /* 0x2E56 */ s16 activeTimer; // Actor Marked for Death when timer runs out /* 0x2E58 */ UNK_TYPE1 unk2E58[0xC]; diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 184a8b81bd..9d7304ec4b 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -33,28 +33,27 @@ const ActorInit En_Dai_InitVars = { static Vec3f D_80B3FBF0 = { 1.0f, 1.0f, 1.0f }; -EnDaiParticle* func_80B3DFF0(EnDaiParticle* particle, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 arg4, f32 arg5, - s32 arg6) { +EnDaiEffect* func_80B3DFF0(EnDaiEffect* effect, Vec3f arg1, Vec3f arg2, Vec3f arg3, f32 arg4, f32 arg5, s32 arg6) { s32 i; - for (i = 0; i < 32; i++, particle++) { - if (!particle->isEnabled) { - particle->isEnabled = true; - particle->unk_01 = (Rand_ZeroOne() * (2.0f * (arg6 / 3.0f))) + (arg6 / 3.0f); - particle->unk_02 = particle->unk_01; - particle->unk_10 = arg1; - particle->unk_1C = arg2; - particle->unk_28 = arg3; - particle->unk_34 = arg4; - particle->unk_38 = arg5; - return particle; + for (i = 0; i < EN_DAI_EFFECT_COUNT; i++, effect++) { + if (!effect->isEnabled) { + effect->isEnabled = true; + effect->unk_01 = (Rand_ZeroOne() * (2.0f * (arg6 / 3.0f))) + (arg6 / 3.0f); + effect->unk_02 = effect->unk_01; + effect->unk_10 = arg1; + effect->unk_1C = arg2; + effect->unk_28 = arg3; + effect->unk_34 = arg4; + effect->unk_38 = arg5; + return effect; } } return NULL; } -void func_80B3E168(EnDaiParticle* particle, GlobalContext* globalCtx2) { +void func_80B3E168(EnDaiEffect* effect, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; s32 pad; s32 isDisplayListSet = false; @@ -65,8 +64,8 @@ void func_80B3E168(EnDaiParticle* particle, GlobalContext* globalCtx2) { func_8012C2DC(globalCtx->state.gfxCtx); - for (i = 0; i < 32; i++, particle++) { - if (particle->isEnabled == true) { + for (i = 0; i < EN_DAI_EFFECT_COUNT; i++, effect++) { + if (effect->isEnabled == true) { gDPPipeSync(POLY_XLU_DISP++); if (!isDisplayListSet) { @@ -76,18 +75,18 @@ void func_80B3E168(EnDaiParticle* particle, GlobalContext* globalCtx2) { Matrix_Push(); - alpha = (particle->unk_02 / (f32)particle->unk_01); + alpha = (effect->unk_02 / (f32)effect->unk_01); alpha *= 255.0f; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (u8)alpha); gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (particle->unk_02 + (i * 3)) * 3, - (particle->unk_02 + (i * 3)) * 15, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (effect->unk_02 + (i * 3)) * 3, + (effect->unk_02 + (i * 3)) * 15, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); - Matrix_Translate(particle->unk_10.x, particle->unk_10.y, particle->unk_10.z, MTXMODE_NEW); + Matrix_Translate(effect->unk_10.x, effect->unk_10.y, effect->unk_10.z, MTXMODE_NEW); Matrix_ReplaceRotation(&globalCtx->billboardMtxF); - Matrix_Scale(particle->unk_34, particle->unk_34, 1.0f, MTXMODE_APPLY); + Matrix_Scale(effect->unk_34, effect->unk_34, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -101,23 +100,23 @@ void func_80B3E168(EnDaiParticle* particle, GlobalContext* globalCtx2) { } s32 func_80B3E460(EnDai* this) { - EnDaiParticle* particle = &this->particles[0]; + EnDaiEffect* effect = this->effects; s32 i; s32 count; - for (i = 0, count = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (particle->isEnabled && particle->unk_02) { - particle->unk_10.x += particle->unk_28.x; - particle->unk_02--; - particle->unk_10.y += particle->unk_28.y; - particle->unk_10.z += particle->unk_28.z; - particle->unk_28.x += particle->unk_1C.x; - particle->unk_28.y += particle->unk_1C.y; - particle->unk_28.z += particle->unk_1C.z; - particle->unk_34 += particle->unk_38; + for (i = 0, count = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled && effect->unk_02) { + effect->unk_10.x += effect->unk_28.x; + effect->unk_02--; + effect->unk_10.y += effect->unk_28.y; + effect->unk_10.z += effect->unk_28.z; + effect->unk_28.x += effect->unk_1C.x; + effect->unk_28.y += effect->unk_1C.y; + effect->unk_28.z += effect->unk_1C.z; + effect->unk_34 += effect->unk_38; count++; - } else if (particle->isEnabled) { - particle->isEnabled = false; + } else if (effect->isEnabled) { + effect->isEnabled = false; } } @@ -125,7 +124,7 @@ s32 func_80B3E460(EnDai* this) { } s32 func_80B3E5B4(EnDai* this, GlobalContext* globalCtx) { - func_80B3E168(this->particles, globalCtx); + func_80B3E168(this->effects, globalCtx); return 0; } @@ -325,7 +324,7 @@ s32 func_80B3E96C(EnDai* this, GlobalContext* globalCtx) { sp5C.y = -40.0f; Lib_Vec3f_TranslateAndRotateY(&this->unk_1E4, this->unk_1D4, &sp50, &sp74); - func_80B3DFF0(this->particles, sp74, sp68, sp5C, 0.03f, 0.04f, 0x10); + func_80B3DFF0(this->effects, sp74, sp68, sp5C, 0.03f, 0.04f, 0x10); } return 0; diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.h b/src/overlays/actors/ovl_En_Dai/z_en_dai.h index 758cd1bc42..4c7e167b9d 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.h +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.h @@ -7,7 +7,7 @@ struct EnDai; typedef void (*EnDaiActionFunc)(struct EnDai*, GlobalContext*); -typedef struct EnDaiParticle { +typedef struct EnDaiEffect { /* 0x00 */ u8 isEnabled; /* 0x01 */ u8 unk_01; /* 0x02 */ u8 unk_02; @@ -17,7 +17,9 @@ typedef struct EnDaiParticle { /* 0x28 */ Vec3f unk_28; /* 0x34 */ f32 unk_34; /* 0x38 */ f32 unk_38; -} EnDaiParticle; // size = 0x3C +} EnDaiEffect; // size = 0x3C + +#define EN_DAI_EFFECT_COUNT 32 typedef struct EnDai { /* 0x000 */ Actor actor; @@ -39,7 +41,7 @@ typedef struct EnDai { /* 0x1FC */ Vec3f unk_1FC; /* 0x208 */ Vec3s jointTable[19]; /* 0x27A */ Vec3s morphTable[19]; - /* 0x2EC */ EnDaiParticle particles[32]; + /* 0x2EC */ EnDaiEffect effects[EN_DAI_EFFECT_COUNT]; /* 0xA6C */ s32 unk_A6C; /* 0xA70 */ s32 unk_A70; } EnDai; // size = 0xA74 diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c index 167c118359..a8d4df8e6c 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.c @@ -493,19 +493,19 @@ void EnDaiku2_Draw(Actor* thisx, GlobalContext* globalCtx) { void func_80BE7504(EnDaiku2* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 arg5) { s16 i; - EnDaiku2Particle* particle = &this->particles[0]; + EnDaiku2Effect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (!particle->isEnabled) { - particle->isEnabled = true; - particle->unk_04 = *arg1; - particle->unk_10 = *arg2; - particle->unk_1C = *arg3; - particle->unk_30 = arg4; - particle->unk_34 = arg5; - particle->unk_28.x = randPlusMinusPoint5Scaled(30000.0f); - particle->unk_28.y = randPlusMinusPoint5Scaled(30000.0f); - particle->unk_28.z = randPlusMinusPoint5Scaled(30000.0f); + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (!effect->isEnabled) { + effect->isEnabled = true; + effect->unk_04 = *arg1; + effect->unk_10 = *arg2; + effect->unk_1C = *arg3; + effect->unk_30 = arg4; + effect->unk_34 = arg5; + effect->unk_28.x = randPlusMinusPoint5Scaled(30000.0f); + effect->unk_28.y = randPlusMinusPoint5Scaled(30000.0f); + effect->unk_28.z = randPlusMinusPoint5Scaled(30000.0f); break; } } @@ -513,20 +513,20 @@ void func_80BE7504(EnDaiku2* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 ar void func_80BE7600(EnDaiku2* this, GlobalContext* globalCtx) { s32 i; - EnDaiku2Particle* particle = &this->particles[0]; + EnDaiku2Effect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (particle->isEnabled) { - particle->unk_04.x += particle->unk_10.x; - particle->unk_28.x += 0x100; - particle->unk_28.z += 0x130; - particle->unk_04.y += particle->unk_10.y; - particle->unk_04.z += particle->unk_10.z; - particle->unk_10.y += particle->unk_1C.y; - if (particle->unk_34 != 0) { - particle->unk_34 -= 1; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + effect->unk_04.x += effect->unk_10.x; + effect->unk_28.x += 0x100; + effect->unk_28.z += 0x130; + effect->unk_04.y += effect->unk_10.y; + effect->unk_04.z += effect->unk_10.z; + effect->unk_10.y += effect->unk_1C.y; + if (effect->unk_34 != 0) { + effect->unk_34 -= 1; } else { - particle->isEnabled = false; + effect->isEnabled = false; } } } @@ -535,7 +535,7 @@ void func_80BE7600(EnDaiku2* this, GlobalContext* globalCtx) { void func_80BE7718(EnDaiku2* this, GlobalContext* globalCtx) { s32 i; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - EnDaiku2Particle* particle = &this->particles[0]; + EnDaiku2Effect* effect = this->effects; s32 objectIdx; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -547,14 +547,14 @@ void func_80BE7718(EnDaiku2* this, GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objectIdx].segment); - for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (particle->isEnabled) { + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { Matrix_Push(); - Matrix_Translate(particle->unk_04.x, particle->unk_04.y, particle->unk_04.z, MTXMODE_NEW); - Matrix_RotateXS(particle->unk_28.x, MTXMODE_APPLY); - Matrix_RotateYS(particle->unk_28.y, MTXMODE_APPLY); - Matrix_RotateZS(particle->unk_28.z, MTXMODE_APPLY); - Matrix_Scale(particle->unk_30, particle->unk_30, particle->unk_30, MTXMODE_APPLY); + Matrix_Translate(effect->unk_04.x, effect->unk_04.y, effect->unk_04.z, MTXMODE_NEW); + Matrix_RotateXS(effect->unk_28.x, MTXMODE_APPLY); + Matrix_RotateYS(effect->unk_28.y, MTXMODE_APPLY); + Matrix_RotateZS(effect->unk_28.z, MTXMODE_APPLY); + Matrix_Scale(effect->unk_30, effect->unk_30, effect->unk_30, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_bombiwa_DL_0009E0); diff --git a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h index 5baadf2f02..3a0cc5ca3c 100644 --- a/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h +++ b/src/overlays/actors/ovl_En_Daiku2/z_en_daiku2.h @@ -17,7 +17,7 @@ enum { /* 127 */ ENDAIKU2_GET_7F_127 = 127, }; -typedef struct EnDaiku2Particle { +typedef struct EnDaiku2Effect { /* 0x00 */ u8 isEnabled; /* 0x04 */ Vec3f unk_04; /* 0x10 */ Vec3f unk_10; @@ -25,7 +25,9 @@ typedef struct EnDaiku2Particle { /* 0x28 */ Vec3s unk_28; /* 0x30 */ f32 unk_30; /* 0x34 */ s16 unk_34; -} EnDaiku2Particle; // size = 0x38 +} EnDaiku2Effect; // size = 0x38 + +#define EN_DAIKU2_EFFECT_COUNT 50 typedef struct EnDaiku2 { /* 0x000 */ Actor actor; @@ -47,7 +49,7 @@ typedef struct EnDaiku2 { /* 0x284 */ f32 unk_284; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; - /* 0x28C */ EnDaiku2Particle particles[50]; + /* 0x28C */ EnDaiku2Effect effects[EN_DAIKU2_EFFECT_COUNT]; /* 0xD7C */ ColliderCylinder collider; } EnDaiku2; // size = 0xDC8 diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c index 914e0f3550..50970a4be1 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.c @@ -33,50 +33,50 @@ const ActorInit En_Dnb_InitVars = { (ActorFunc)EnDnb_Draw, }; -void func_80A4FDD0(EnDnbParticle* particle, EnDnb* this, s16* alloc, s32 idx) { +void func_80A4FDD0(EnDnbEffect* effect, EnDnb* this, s16* alloc, s32 idx) { Vec3f sp1C; s32 idx2 = idx * 3; sp1C.x = alloc[idx2 + 0] + this->dyna.actor.world.pos.x; sp1C.y = alloc[idx2 + 1] + this->dyna.actor.world.pos.y; sp1C.z = alloc[idx2 + 2] + this->dyna.actor.world.pos.z; - particle->unk_00 = sp1C; - particle->unk_0C = sp1C; - particle->unk_24 = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &sp1C); - particle->unk_18 = gZeroVec3s; + effect->unk_00 = sp1C; + effect->unk_0C = sp1C; + effect->unk_24 = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &sp1C); + effect->unk_18 = gZeroVec3s; } -s32 func_80A4FEBC(EnDnbParticle* particle, f32 arg1) { +s32 func_80A4FEBC(EnDnbEffect* effect, f32 arg1) { s32 ret = false; - if ((DECR(particle->unk_26) == 0) && (arg1 < particle->unk_0C.y)) { - Math_ApproachF(&particle->unk_30, 1.0f, 0.4f, 1.0f); - particle->unk_2C += particle->unk_34; - particle->unk_0C.x += particle->unk_30 * Math_SinS(particle->unk_24); - particle->unk_0C.z += particle->unk_30 * Math_CosS(particle->unk_24); - particle->unk_0C.y += particle->unk_2C; - if (particle->unk_0C.y <= arg1) { - particle->unk_0C.y = arg1; + if ((DECR(effect->unk_26) == 0) && (arg1 < effect->unk_0C.y)) { + Math_ApproachF(&effect->unk_30, 1.0f, 0.4f, 1.0f); + effect->unk_2C += effect->unk_34; + effect->unk_0C.x += effect->unk_30 * Math_SinS(effect->unk_24); + effect->unk_0C.z += effect->unk_30 * Math_CosS(effect->unk_24); + effect->unk_0C.y += effect->unk_2C; + if (effect->unk_0C.y <= arg1) { + effect->unk_0C.y = arg1; } - particle->unk_18.x += particle->unk_1E.x; - particle->unk_18.y += particle->unk_1E.y; - particle->unk_18.z += particle->unk_1E.z; + effect->unk_18.x += effect->unk_1E.x; + effect->unk_18.y += effect->unk_1E.y; + effect->unk_18.z += effect->unk_1E.z; ret = true; } return ret; } -void func_80A4FFE8(EnDnbParticle* particle, s16 arg1) { - particle->unk_0C = particle->unk_00; - particle->unk_1E.x = (Rand_ZeroOne() - 0.5f) * 400.0f; - particle->unk_1E.y = (Rand_ZeroOne() - 0.5f) * 400.0f; - particle->unk_1E.z = (Rand_ZeroOne() - 0.5f) * 400.0f; - particle->unk_18 = gZeroVec3s; - particle->unk_30 = 40.0f; - particle->unk_2C = 0.0f; - particle->unk_26 = arg1; - particle->unk_34 = (Rand_ZeroOne() * -2.0f) - 2.0f; +void func_80A4FFE8(EnDnbEffect* effect, s16 arg1) { + effect->unk_0C = effect->unk_00; + effect->unk_1E.x = (Rand_ZeroOne() - 0.5f) * 400.0f; + effect->unk_1E.y = (Rand_ZeroOne() - 0.5f) * 400.0f; + effect->unk_1E.z = (Rand_ZeroOne() - 0.5f) * 400.0f; + effect->unk_18 = gZeroVec3s; + effect->unk_30 = 40.0f; + effect->unk_2C = 0.0f; + effect->unk_26 = arg1; + effect->unk_34 = (Rand_ZeroOne() * -2.0f) - 2.0f; } s32 func_80A500F8(EnDnb* this) { @@ -108,8 +108,8 @@ void EnDnb_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_hanareyama_obj_Colheader_004D8C); alloc = Lib_SegmentedToVirtual(object_hanareyama_obj_Vec_004710); - for (i = 0; i < ARRAY_COUNT(this->particles); i++) { - func_80A4FDD0(&this->particles[i], this, alloc, i); + for (i = 0; i < ARRAY_COUNT(this->effects); i++) { + func_80A4FDD0(&this->effects[i], this, alloc, i); } Actor_SetScale(&this->dyna.actor, 1.0f); @@ -126,8 +126,8 @@ void EnDnb_Update(Actor* thisx, GlobalContext* globalCtx) { s32 i; if (this->unk_0D30 == 0) { - for (i = 0; i < ARRAY_COUNT(this->particles); i++) { - func_80A4FFE8(&this->particles[i], ((53 - i) / 18) * 4); + for (i = 0; i < ARRAY_COUNT(this->effects); i++) { + func_80A4FFE8(&this->effects[i], ((53 - i) / 18) * 4); } for (i = 0; i < ARRAY_COUNT(this->unk_0D38); i++) { @@ -141,8 +141,8 @@ void EnDnb_Update(Actor* thisx, GlobalContext* globalCtx) { func_80A500F8(this); } - for (i = 0; i < ARRAY_COUNT(this->particles); i++) { - func_80A4FEBC(&this->particles[i], this->dyna.actor.world.pos.y); + for (i = 0; i < ARRAY_COUNT(this->effects); i++) { + func_80A4FEBC(&this->effects[i], this->dyna.actor.world.pos.y); } this->unk_0D30--; @@ -158,13 +158,12 @@ void func_80A50510(EnDnb* this, GlobalContext* globalCtx) { func_8012C2DC(globalCtx->state.gfxCtx); - for (i = 0; i < ARRAY_COUNT(this->particles); i++) { + for (i = 0; i < ARRAY_COUNT(this->effects); i++) { Matrix_Push(); - Matrix_Translate(this->particles[i].unk_0C.x, this->particles[i].unk_0C.y, this->particles[i].unk_0C.z, - MTXMODE_NEW); - Matrix_RotateXS(this->particles[i].unk_18.x, MTXMODE_APPLY); - Matrix_RotateYS(this->particles[i].unk_18.y, MTXMODE_APPLY); - Matrix_RotateZS(this->particles[i].unk_18.z, MTXMODE_APPLY); + Matrix_Translate(this->effects[i].unk_0C.x, this->effects[i].unk_0C.y, this->effects[i].unk_0C.z, MTXMODE_NEW); + Matrix_RotateXS(this->effects[i].unk_18.x, MTXMODE_APPLY); + Matrix_RotateYS(this->effects[i].unk_18.y, MTXMODE_APPLY); + Matrix_RotateZS(this->effects[i].unk_18.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gfx[i]); @@ -183,13 +182,12 @@ void func_80A5063C(EnDnb* this, GlobalContext* globalCtx) { func_8012C28C(globalCtx->state.gfxCtx); - for (i = 0; i < ARRAY_COUNT(this->particles); i++) { + for (i = 0; i < ARRAY_COUNT(this->effects); i++) { Matrix_Push(); - Matrix_Translate(this->particles[i].unk_0C.x, this->particles[i].unk_0C.y, this->particles[i].unk_0C.z, - MTXMODE_NEW); - Matrix_RotateXS(this->particles[i].unk_18.x, MTXMODE_APPLY); - Matrix_RotateYS(this->particles[i].unk_18.y, MTXMODE_APPLY); - Matrix_RotateZS(this->particles[i].unk_18.z, MTXMODE_APPLY); + Matrix_Translate(this->effects[i].unk_0C.x, this->effects[i].unk_0C.y, this->effects[i].unk_0C.z, MTXMODE_NEW); + Matrix_RotateXS(this->effects[i].unk_18.x, MTXMODE_APPLY); + Matrix_RotateYS(this->effects[i].unk_18.y, MTXMODE_APPLY); + Matrix_RotateZS(this->effects[i].unk_18.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gfx[i]); diff --git a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.h b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.h index d5ec9554a9..17ee19abef 100644 --- a/src/overlays/actors/ovl_En_Dnb/z_en_dnb.h +++ b/src/overlays/actors/ovl_En_Dnb/z_en_dnb.h @@ -16,7 +16,7 @@ typedef struct { /* 0x2C */ f32 unk_2C; /* 0x30 */ f32 unk_30; /* 0x34 */ f32 unk_34; -} EnDnbParticle; // size = 0x38 +} EnDnbEffect; // size = 0x38 typedef struct { /* 0x00 */ u8 isEnabled; @@ -29,10 +29,12 @@ typedef struct { /* 0x24 */ f32 unk_24; } EnDnbUnkStruct; // size = 0x28 +#define EN_DNB_EFFECT_COUNT 54 + typedef struct EnDnb { /* 0x0000 */ DynaPolyActor dyna; /* 0x015C */ UNK_TYPE1 unk_015C[0x4]; - /* 0x0160 */ EnDnbParticle particles[54]; + /* 0x0160 */ EnDnbEffect effects[EN_DNB_EFFECT_COUNT]; /* 0x0D30 */ s16 unk_0D30; /* 0x0D32 */ s16 unk_0D32; /* 0x0D34 */ s16 unk_0D34; diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index ea7ee7aa41..62d33b0eaf 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -21,9 +21,9 @@ void EnEncount2_Idle(EnEncount2* this, GlobalContext* globalCtx); void EnEncount2_Popped(EnEncount2* this, GlobalContext* globalCtx); void EnEncount2_Die(EnEncount2* this, GlobalContext* globalCtx); void EnEncount2_SetIdle(EnEncount2* this); -void EnEncount2_InitParticles(EnEncount2* this, Vec3f* pos, s16 fadeDelay); -void EnEncount2_UpdateParticles(EnEncount2* this, GlobalContext* globalCtx); -void EnEncount2_DrawParticles(EnEncount2* this, GlobalContext* globalCtx); +void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay); +void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx); +void EnEncount2_DrawEffects(EnEncount2* this, GlobalContext* globalCtx); const ActorInit En_Encount2_InitVars = { ACTOR_EN_ENCOUNT2, @@ -166,8 +166,8 @@ void EnEncount2_Popped(EnEncount2* this, GlobalContext* globalCtx) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, curPos.x, curPos.y, curPos.z, 255, 255, 200, CLEAR_TAG_LARGE_EXPLOSION); - for (i = 0; i < ARRAY_COUNT(this->particles) / 2; ++i) { - EnEncount2_InitParticles(this, &curPos, 10); + for (i = 0; i < ARRAY_COUNT(this->effects) / 2; ++i) { + EnEncount2_InitEffects(this, &curPos, 10); } Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_MUJURA_BALLOON_BROKEN); @@ -195,7 +195,7 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->dyna.actor, this->scale); this->actionFunc(this, globalCtx); Actor_MoveWithGravity(&this->dyna.actor); - EnEncount2_UpdateParticles(this, globalCtx); + EnEncount2_UpdateEffects(this, globalCtx); if (!this->isPopped) { Collider_UpdateSpheresElement(&this->collider, 0, &this->dyna.actor); @@ -210,16 +210,16 @@ void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx) { Gfx_DrawDListOpa(globalCtx, object_fusen_DL_000A00); Gfx_DrawDListOpa(globalCtx, object_fusen_DL_000D78); } - EnEncount2_DrawParticles(this, globalCtx); + EnEncount2_DrawEffects(this, globalCtx); } -void EnEncount2_InitParticles(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { +void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { s16 i; - EnEncount2Particle* sPtr = this->particles; + EnEncount2Effect* sPtr = this->effects; - for (i = 0; i < ARRAY_COUNT(this->particles); i++, sPtr++) { - if (!sPtr->enabled) { - sPtr->enabled = true; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { + if (!sPtr->isEnabled) { + sPtr->isEnabled = true; sPtr->pos = *pos; sPtr->alphaFadeDelay = fadeDelay; sPtr->alpha = 0xFF; @@ -228,9 +228,9 @@ void EnEncount2_InitParticles(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { sPtr->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f; sPtr->accel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; - sPtr->vel.x = Rand_ZeroOne() - 0.5f; - sPtr->vel.y = Rand_ZeroOne() - 0.5f; - sPtr->vel.z = Rand_ZeroOne() - 0.5f; + sPtr->velocity.x = Rand_ZeroOne() - 0.5f; + sPtr->velocity.y = Rand_ZeroOne() - 0.5f; + sPtr->velocity.z = Rand_ZeroOne() - 0.5f; sPtr->scale = (Rand_ZeroFloat(1.0f) * 0.5f) + 2.0f; return; @@ -238,42 +238,42 @@ void EnEncount2_InitParticles(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { } } -void EnEncount2_UpdateParticles(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) { s32 i; - EnEncount2Particle* sPtr = this->particles; + EnEncount2Effect* sPtr = this->effects; - for (i = 0; i < ARRAY_COUNT(this->particles); i++, sPtr++) { - if (sPtr->enabled) { - sPtr->pos.x += sPtr->vel.x; - sPtr->pos.y += sPtr->vel.y; - sPtr->pos.z += sPtr->vel.z; - sPtr->vel.x += sPtr->accel.x; - sPtr->vel.y += sPtr->accel.y; - sPtr->vel.z += sPtr->accel.z; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { + if (sPtr->isEnabled) { + sPtr->pos.x += sPtr->velocity.x; + sPtr->pos.y += sPtr->velocity.y; + sPtr->pos.z += sPtr->velocity.z; + sPtr->velocity.x += sPtr->accel.x; + sPtr->velocity.y += sPtr->accel.y; + sPtr->velocity.z += sPtr->accel.z; if (sPtr->alphaFadeDelay != 0) { sPtr->alphaFadeDelay--; } else { sPtr->alpha -= 10; if (sPtr->alpha < 10) { - sPtr->enabled = 0; + sPtr->isEnabled = 0; } } } } } -void EnEncount2_DrawParticles(EnEncount2* this, GlobalContext* globalCtx) { +void EnEncount2_DrawEffects(EnEncount2* this, GlobalContext* globalCtx) { s16 i; - EnEncount2Particle* sPtr; + EnEncount2Effect* sPtr; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; OPEN_DISPS(gfxCtx); - sPtr = this->particles; + sPtr = this->effects; func_8012C28C(gfxCtx); func_8012C2DC(globalCtx->state.gfxCtx); - for (i = 0; i < ARRAY_COUNT(this->particles); i++, sPtr++) { - if (sPtr->enabled) { + for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { + if (sPtr->isEnabled) { Matrix_Translate(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW); Matrix_Scale(sPtr->scale, sPtr->scale, sPtr->scale, MTXMODE_APPLY); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20); diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h index f2ce8832f0..a95c1e014c 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h @@ -7,16 +7,18 @@ struct EnEncount2; typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, GlobalContext*); -typedef struct EnEncount2Particle{ - /* 0x00 */ u8 enabled; +typedef struct EnEncount2Effect{ + /* 0x00 */ u8 isEnabled; /* 0x04 */ Vec3f pos; /* 0x10 */ UNK_TYPE4 unk10; /* 0x14 */ s16 alpha; /* 0x16 */ s16 alphaFadeDelay; // frame count before alpha fade starts - /* 0x18 */ Vec3f vel; + /* 0x18 */ Vec3f velocity; /* 0x24 */ Vec3f accel; /* 0x30 */ f32 scale; -} EnEncount2Particle; // size = 0x34 +} EnEncount2Effect; // size = 0x34 + +#define EN_ENCOUNT2_EFFECT_COUNT 200 typedef struct EnEncount2 { /* 0x0000 */ DynaPolyActor dyna; @@ -28,7 +30,7 @@ typedef struct EnEncount2 { /* 0x016C */ f32 oscillationAngle; /* 0x0170 */ ColliderJntSph collider; /* 0x0190 */ ColliderJntSphElement colElement; - /* 0x01D0 */ EnEncount2Particle particles[200]; + /* 0x01D0 */ EnEncount2Effect effects[EN_ENCOUNT2_EFFECT_COUNT]; } EnEncount2; // size = 0x2A70 #define GET_ENCOUNT2_SWITCH_FLAG(actor) ((s16)(((Actor*)actor)->params & 0x7F)) diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index b84eb3d748..d426b7c595 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -56,9 +56,11 @@ typedef struct { Vec3f pos; Vec3f velocity; Vec3s rot; -} EnFallDebrisParticle; +} EnFallDebrisEffect; -EnFallDebrisParticle debrisParticles[50]; +#define EN_FALL_DEBRIS_EFFECT_COUNT 50 + +EnFallDebrisEffect debrisEffects[EN_FALL_DEBRIS_EFFECT_COUNT]; const ActorInit En_Fall_InitVars = { ACTOR_EN_FALL, @@ -115,13 +117,13 @@ void EnFall_Moon_AdjustScaleAndPosition(EnFall* this, GlobalContext* globalCtx) } } -void EnFall_RisingDebris_ResetParticles(EnFall* this) { +void EnFall_RisingDebris_ResetEffects(EnFall* this) { s32 i; - for (i = 0; i < ARRAY_COUNT(debrisParticles); i++) { - debrisParticles[i].modelIndex = 3; + for (i = 0; i < ARRAY_COUNT(debrisEffects); i++) { + debrisEffects[i].modelIndex = 3; } - this->activeDebrisParticleCount = 0; + this->activeDebrisEffectCount = 0; } void EnFall_Init(Actor* thisx, GlobalContext* globalCtx) { @@ -252,7 +254,7 @@ void EnFall_Setup(EnFall* this, GlobalContext* globalCtx) { this->actor.update = EnFall_RisingDebris_Update; this->actor.draw = EnFall_RisingDebris_Draw; this->scale = 1.0f; - EnFall_RisingDebris_ResetParticles(this); + EnFall_RisingDebris_ResetEffects(this); Actor_SetScale(&this->actor, 1.0f); this->actor.shape.rot.x = 0; break; @@ -631,47 +633,47 @@ void EnFall_Fireball_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->scale * 1.74f); } -void EnFall_RisingDebris_UpdateParticles(EnFall* this) { +void EnFall_RisingDebris_UpdateEffects(EnFall* this) { s32 i; - for (i = 0; i < ARRAY_COUNT(debrisParticles); i++) { - if (debrisParticles[i].modelIndex < 3) { - debrisParticles[i].pos.x += debrisParticles[i].velocity.x; - debrisParticles[i].pos.y += debrisParticles[i].velocity.y; - debrisParticles[i].pos.z += debrisParticles[i].velocity.z; - debrisParticles[i].rot.x += 0x64; - debrisParticles[i].rot.y += 0xC8; - debrisParticles[i].rot.z += 0x12C; - if ((this->actor.world.pos.y + 3000.0f) < debrisParticles[i].pos.y) { - debrisParticles[i].modelIndex = 3; - this->activeDebrisParticleCount--; + for (i = 0; i < ARRAY_COUNT(debrisEffects); i++) { + if (debrisEffects[i].modelIndex < 3) { + debrisEffects[i].pos.x += debrisEffects[i].velocity.x; + debrisEffects[i].pos.y += debrisEffects[i].velocity.y; + debrisEffects[i].pos.z += debrisEffects[i].velocity.z; + debrisEffects[i].rot.x += 0x64; + debrisEffects[i].rot.y += 0xC8; + debrisEffects[i].rot.z += 0x12C; + if ((this->actor.world.pos.y + 3000.0f) < debrisEffects[i].pos.y) { + debrisEffects[i].modelIndex = 3; + this->activeDebrisEffectCount--; } } } } -s32 EnFall_RisingDebris_InitializeParticles(EnFall* this) { +s32 EnFall_RisingDebris_InitializeEffect(EnFall* this) { s16 angle; s32 i; f32 scale; - for (i = 0; i < ARRAY_COUNT(debrisParticles); i++) { - if (debrisParticles[i].modelIndex >= 3) { - debrisParticles[i].modelIndex = (s32)Rand_ZeroFloat(3.0f); - debrisParticles[i].pos.x = this->actor.world.pos.x; - debrisParticles[i].pos.y = this->actor.world.pos.y; - debrisParticles[i].pos.z = this->actor.world.pos.z; + for (i = 0; i < ARRAY_COUNT(debrisEffects); i++) { + if (debrisEffects[i].modelIndex >= 3) { + debrisEffects[i].modelIndex = (s32)Rand_ZeroFloat(3.0f); + debrisEffects[i].pos.x = this->actor.world.pos.x; + debrisEffects[i].pos.y = this->actor.world.pos.y; + debrisEffects[i].pos.z = this->actor.world.pos.z; angle = randPlusMinusPoint5Scaled(0x10000); scale = (1.0f - (Rand_ZeroFloat(1.0f) * Rand_ZeroFloat(1.0f))) * 3000.0f; - debrisParticles[i].pos.x += Math_SinS(angle) * scale; - debrisParticles[i].pos.z += Math_CosS(angle) * scale; - debrisParticles[i].velocity.x = 0.0f; - debrisParticles[i].velocity.z = 0.0f; - debrisParticles[i].velocity.y = 80.0f; - debrisParticles[i].rot.x = randPlusMinusPoint5Scaled(0x10000); - debrisParticles[i].rot.y = randPlusMinusPoint5Scaled(0x10000); - debrisParticles[i].rot.z = randPlusMinusPoint5Scaled(0x10000); - this->activeDebrisParticleCount++; + debrisEffects[i].pos.x += Math_SinS(angle) * scale; + debrisEffects[i].pos.z += Math_CosS(angle) * scale; + debrisEffects[i].velocity.x = 0.0f; + debrisEffects[i].velocity.z = 0.0f; + debrisEffects[i].velocity.y = 80.0f; + debrisEffects[i].rot.x = randPlusMinusPoint5Scaled(0x10000); + debrisEffects[i].rot.y = randPlusMinusPoint5Scaled(0x10000); + debrisEffects[i].rot.z = randPlusMinusPoint5Scaled(0x10000); + this->activeDebrisEffectCount++; return true; } } @@ -685,14 +687,14 @@ void EnFall_RisingDebris_Update(Actor* thisx, GlobalContext* globalCtx) { if (Cutscene_CheckActorAction(globalCtx, 451)) { if (Cutscene_CheckActorAction(globalCtx, 451) && globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 451)]->action == 2) { - EnFall_RisingDebris_UpdateParticles(this); - EnFall_RisingDebris_InitializeParticles(this); - } else if (this->activeDebrisParticleCount != 0) { - EnFall_RisingDebris_ResetParticles(this); + EnFall_RisingDebris_UpdateEffects(this); + EnFall_RisingDebris_InitializeEffect(this); + } else if (this->activeDebrisEffectCount != 0) { + EnFall_RisingDebris_ResetEffects(this); } } else if (thisx->home.rot.x != 0) { - EnFall_RisingDebris_UpdateParticles(this); - EnFall_RisingDebris_InitializeParticles(this); + EnFall_RisingDebris_UpdateEffects(this); + EnFall_RisingDebris_InitializeEffect(this); } } @@ -868,15 +870,14 @@ void EnFall_RisingDebris_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - for (i = 0; i < ARRAY_COUNT(debrisParticles); i++) { - if (debrisParticles[i].modelIndex < 3) { - Matrix_Translate(debrisParticles[i].pos.x, debrisParticles[i].pos.y, debrisParticles[i].pos.z, MTXMODE_NEW); + for (i = 0; i < ARRAY_COUNT(debrisEffects); i++) { + if (debrisEffects[i].modelIndex < 3) { + Matrix_Translate(debrisEffects[i].pos.x, debrisEffects[i].pos.y, debrisEffects[i].pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_RotateZYX(debrisParticles[i].rot.x, debrisParticles[i].rot.y, debrisParticles[i].rot.z, - MTXMODE_APPLY); + Matrix_RotateZYX(debrisEffects[i].rot.x, debrisEffects[i].rot.y, debrisEffects[i].rot.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, sDebrisModelDLists[debrisParticles[i].modelIndex]); + gSPDisplayList(POLY_OPA_DISP++, sDebrisModelDLists[debrisEffects[i].modelIndex]); } } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.h b/src/overlays/actors/ovl_En_Fall/z_en_fall.h index 620c0590a0..308b8ba9b9 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.h +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.h @@ -40,7 +40,7 @@ typedef struct EnFall { /* 0x154 */ u16 flags; /* 0x158 */ union { s32 fireballAlpha; - s32 activeDebrisParticleCount; + s32 activeDebrisEffectCount; }; /* 0x15C */ union { s16 fireballYTexScroll1; diff --git a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c index 63da6c3296..8feabc0c75 100644 --- a/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c +++ b/src/overlays/actors/ovl_En_Hakurock/z_en_hakurock.c @@ -94,36 +94,36 @@ void func_80B21BE0(BossHakugin* parent, Vec3f* arg1, s32 arg2) { s32 i; for (i = 0; i < ARRAY_COUNT(parent->unk_9F8); i++) { - BossHakuginParticle* gohtParticle = &parent->unk_9F8[i]; - if (gohtParticle->unk_18 < 0) { + BossHakuginEffect* gohtEffect = &parent->unk_9F8[i]; + if (gohtEffect->unk_18 < 0) { s16 sp2E; s16 sp2C; f32 sp28; - Math_Vec3f_Copy(&gohtParticle->unk_0, arg1); + Math_Vec3f_Copy(&gohtEffect->unk_0, arg1); sp2C = Rand_S16Offset(0x1000, 0x3000); sp2E = Rand_Next() >> 0x10; sp28 = Rand_ZeroFloat(5.0f) + 10.0f; - gohtParticle->unk_C.x = (sp28 * Math_CosS(sp2C)) * Math_SinS(sp2E); - gohtParticle->unk_C.y = (Math_SinS(sp2C) * sp28); - gohtParticle->unk_C.z = (sp28 * Math_CosS(sp2C)) * Math_CosS(sp2E); + gohtEffect->unk_C.x = (sp28 * Math_CosS(sp2C)) * Math_SinS(sp2E); + gohtEffect->unk_C.y = (Math_SinS(sp2C) * sp28); + gohtEffect->unk_C.z = (sp28 * Math_CosS(sp2C)) * Math_CosS(sp2E); if ((arg2 == 1) || (arg2 == 3)) { - gohtParticle->unk_24 = ((Rand_ZeroFloat(5.0f) + 25.0f) * 0.0012f); - gohtParticle->unk_0.x = ((Rand_ZeroFloat(2.0f) + 9.0f) * gohtParticle->unk_C.x) + arg1->x; - gohtParticle->unk_0.y = ((Rand_ZeroFloat(2.0f) + 3.0f) * gohtParticle->unk_C.y) + arg1->y; - gohtParticle->unk_0.z = ((Rand_ZeroFloat(2.0f) + 9.0f) * gohtParticle->unk_C.z) + arg1->z; - gohtParticle->unk_1A = 1; + gohtEffect->unk_24 = ((Rand_ZeroFloat(5.0f) + 25.0f) * 0.0012f); + gohtEffect->unk_0.x = ((Rand_ZeroFloat(2.0f) + 9.0f) * gohtEffect->unk_C.x) + arg1->x; + gohtEffect->unk_0.y = ((Rand_ZeroFloat(2.0f) + 3.0f) * gohtEffect->unk_C.y) + arg1->y; + gohtEffect->unk_0.z = ((Rand_ZeroFloat(2.0f) + 9.0f) * gohtEffect->unk_C.z) + arg1->z; + gohtEffect->unk_1A = 1; } else { - gohtParticle->unk_24 = ((Rand_ZeroFloat(5.0f) + 18.0f) * 0.0001f); - gohtParticle->unk_0.x = ((Rand_ZeroFloat(2.0f) + 3.0f) * gohtParticle->unk_C.x) + arg1->x; - gohtParticle->unk_0.y = ((Rand_ZeroFloat(3.0f) + 1.0f) * gohtParticle->unk_C.y) + arg1->y; - gohtParticle->unk_0.z = ((Rand_ZeroFloat(2.0f) + 3.0f) * gohtParticle->unk_C.z) + arg1->z; - gohtParticle->unk_1A = 0; + gohtEffect->unk_24 = ((Rand_ZeroFloat(5.0f) + 18.0f) * 0.0001f); + gohtEffect->unk_0.x = ((Rand_ZeroFloat(2.0f) + 3.0f) * gohtEffect->unk_C.x) + arg1->x; + gohtEffect->unk_0.y = ((Rand_ZeroFloat(3.0f) + 1.0f) * gohtEffect->unk_C.y) + arg1->y; + gohtEffect->unk_0.z = ((Rand_ZeroFloat(2.0f) + 3.0f) * gohtEffect->unk_C.z) + arg1->z; + gohtEffect->unk_1A = 0; } - gohtParticle->unk_1C.x = (s32)Rand_Next() >> 0x10; - gohtParticle->unk_1C.y = (s32)Rand_Next() >> 0x10; - gohtParticle->unk_1C.z = (s32)Rand_Next() >> 0x10; - gohtParticle->unk_18 = 0x28; + gohtEffect->unk_1C.x = (s32)Rand_Next() >> 0x10; + gohtEffect->unk_1C.y = (s32)Rand_Next() >> 0x10; + gohtEffect->unk_1C.z = (s32)Rand_Next() >> 0x10; + gohtEffect->unk_18 = 0x28; return; } } diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 68f587ba3f..2ffb3d0bad 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -185,18 +185,18 @@ void EnMinislime_AddIceShardEffect(EnMinislime* this) { for (; i < i_end; i++) { iceShardEffect = &bigslime->iceShardEffect[i]; vecSph.pitch = Rand_S16Offset(0x1000, 0x3000); - iceShardEffect->vel.x = Math_CosS(vecSph.pitch) * Math_SinS(vecSph.yaw); - iceShardEffect->vel.y = Math_SinS(vecSph.pitch); - iceShardEffect->vel.z = Math_CosS(vecSph.pitch) * Math_CosS(vecSph.yaw); - iceShardEffect->pos.x = this->actor.world.pos.x + (400.0f * this->actor.scale.x) * iceShardEffect->vel.x; + iceShardEffect->velocity.x = Math_CosS(vecSph.pitch) * Math_SinS(vecSph.yaw); + iceShardEffect->velocity.y = Math_SinS(vecSph.pitch); + iceShardEffect->velocity.z = Math_CosS(vecSph.pitch) * Math_CosS(vecSph.yaw); + iceShardEffect->pos.x = this->actor.world.pos.x + (400.0f * this->actor.scale.x) * iceShardEffect->velocity.x; iceShardEffect->pos.y = - this->actor.world.pos.y + (((iceShardEffect->vel.y * 2.0f) - 1.0f) * 400.0f * this->actor.scale.y); - iceShardEffect->pos.z = this->actor.world.pos.z + (400.0f * this->actor.scale.z) * iceShardEffect->vel.z; - iceShardEffect->rotation.x = (s32)Rand_Next() >> 0x10; - iceShardEffect->rotation.y = (s32)Rand_Next() >> 0x10; - iceShardEffect->rotation.z = (s32)Rand_Next() >> 0x10; - iceShardEffect->isActive = true; - Math_Vec3f_ScaleAndStore(&iceShardEffect->vel, Rand_ZeroFloat(3.0f) + 7.0f, &iceShardEffect->vel); + this->actor.world.pos.y + (((iceShardEffect->velocity.y * 2.0f) - 1.0f) * 400.0f * this->actor.scale.y); + iceShardEffect->pos.z = this->actor.world.pos.z + (400.0f * this->actor.scale.z) * iceShardEffect->velocity.z; + iceShardEffect->rot.x = (s32)Rand_Next() >> 0x10; + iceShardEffect->rot.y = (s32)Rand_Next() >> 0x10; + iceShardEffect->rot.z = (s32)Rand_Next() >> 0x10; + iceShardEffect->isEnabled = true; + Math_Vec3f_ScaleAndStore(&iceShardEffect->velocity, Rand_ZeroFloat(3.0f) + 7.0f, &iceShardEffect->velocity); iceShardEffect->scale = (Rand_ZeroFloat(6.0f) + 2.0f) * 0.001f; vecSph.yaw += 0x1999; } diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c index fb3b1070e9..225feec706 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -30,9 +30,9 @@ void EnRaf_SetupDissolve(EnRaf* this); void EnRaf_Dissolve(EnRaf* this, GlobalContext* globalCtx); void EnRaf_SetupDormant(EnRaf* this); void EnRaf_Dormant(EnRaf* this, GlobalContext* globalCtx); -void EnRaf_InitializeParticle(EnRaf* this, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, s16 timer); -void EnRaf_UpdateParticles(EnRaf* this, GlobalContext* globalCtx); -void EnRaf_DrawParticles(EnRaf* this, GlobalContext* globalCtx); +void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 timer); +void EnRaf_UpdateEffects(EnRaf* this, GlobalContext* globalCtx); +void EnRaf_DrawEffects(EnRaf* this, GlobalContext* globalCtx); typedef enum { /* 0 */ EN_RAF_ANIMATION_IDLE, @@ -494,11 +494,11 @@ void EnRaf_Throw(EnRaf* this, GlobalContext* globalCtx) { } /** - * Creates an explosion effect/sound and spawns particles. + * Creates an explosion effect/sound and spawns effects. */ void EnRaf_Explode(EnRaf* this, GlobalContext* globalCtx) { Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - Vec3f acceleration = { 0.0f, 0.0f, 0.0f }; + Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f explosionPos; s32 i; s32 pad; @@ -516,14 +516,14 @@ void EnRaf_Explode(EnRaf* this, GlobalContext* globalCtx) { this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_DEAD; for (i = 0; i < BREG(57) + 30; i++) { - acceleration.x = (Rand_ZeroOne() - 0.5f) * 0.5f; - acceleration.y = -0.3f; - acceleration.z = (Rand_ZeroOne() - 0.5f) * 0.5f; + accel.x = (Rand_ZeroOne() - 0.5f) * 0.5f; + accel.y = -0.3f; + accel.z = (Rand_ZeroOne() - 0.5f) * 0.5f; velocity.x = Rand_ZeroOne() - 0.5f; velocity.y = Rand_ZeroOne() * 10.0f; velocity.z = Rand_ZeroOne() - 0.5f; - EnRaf_InitializeParticle(this, &this->dyna.actor.world.pos, &velocity, &acceleration, - (Rand_ZeroFloat(1.0f) / 500.0f) + 0.002f, 90); + EnRaf_InitializeEffect(this, &this->dyna.actor.world.pos, &velocity, &accel, + (Rand_ZeroFloat(1.0f) / 500.0f) + 0.002f, 90); } for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; i++) { @@ -742,7 +742,7 @@ void EnRaf_Update(Actor* thisx, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->heightDiffFromPlayer, 0.3f, 2.0f); if (this->action == EN_RAF_ACTION_EXPLODE) { - EnRaf_UpdateParticles(this, globalCtx); + EnRaf_UpdateEffects(this, globalCtx); } for (i = 0; i < ARRAY_COUNT(this->limbScale); i++) { @@ -875,84 +875,83 @@ void EnRaf_Draw(Actor* thisx, GlobalContext* globalCtx) { this->skelAnime.dListCount, NULL, NULL, EnRaf_TransformLimbDraw, &this->dyna.actor); if (this->action == EN_RAF_ACTION_EXPLODE) { - EnRaf_DrawParticles(this, globalCtx); + EnRaf_DrawEffects(this, globalCtx); } } -void EnRaf_InitializeParticle(EnRaf* this, Vec3f* position, Vec3f* velocity, Vec3f* acceleration, f32 scale, - s16 timer) { +void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 timer) { s16 i; - EnRafParticle* particle = this->particles; + EnRafEffect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (!particle->isVisible) { - particle->isVisible = true; - particle->position = *position; - particle->velocity = *velocity; - particle->acceleration = *acceleration; - particle->scale = scale; - particle->timer = timer; - particle->rotation.x = randPlusMinusPoint5Scaled(30000.0f); - particle->rotation.y = randPlusMinusPoint5Scaled(30000.0f); - particle->rotation.z = randPlusMinusPoint5Scaled(30000.0f); + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (!effect->isEnabled) { + effect->isEnabled = true; + effect->pos = *pos; + effect->velocity = *velocity; + effect->accel = *accel; + effect->scale = scale; + effect->timer = timer; + effect->rotation.x = randPlusMinusPoint5Scaled(30000.0f); + effect->rotation.y = randPlusMinusPoint5Scaled(30000.0f); + effect->rotation.z = randPlusMinusPoint5Scaled(30000.0f); return; } } } -void EnRaf_UpdateParticles(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_UpdateEffects(EnRaf* this, GlobalContext* globalCtx) { s32 i; - EnRafParticle* particle = this->particles; + EnRafEffect* effect = this->effects; - for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (particle->isVisible) { - particle->position.x += particle->velocity.x; - particle->position.y += particle->velocity.y; - particle->position.z += particle->velocity.z; - particle->rotation.x += 0xBB8; - particle->rotation.y += 0xBB8; - particle->rotation.z += 0xBB8; - particle->velocity.x += particle->acceleration.x; - particle->velocity.y += particle->acceleration.y; - particle->velocity.z += particle->acceleration.z; + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + effect->pos.x += effect->velocity.x; + effect->pos.y += effect->velocity.y; + effect->pos.z += effect->velocity.z; + effect->rotation.x += 0xBB8; + effect->rotation.y += 0xBB8; + effect->rotation.z += 0xBB8; + effect->velocity.x += effect->accel.x; + effect->velocity.y += effect->accel.y; + effect->velocity.z += effect->accel.z; if (this->mainType != EN_RAF_TYPE_NO_WATER_INTERACTIONS) { - if (particle->position.y < (this->dyna.actor.world.pos.y - 10.0f)) { - EffectSsGSplash_Spawn(globalCtx, &particle->position, NULL, NULL, 0, particle->scale * 200000.0f); - SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &particle->position, 50, NA_SE_EV_BOMB_DROP_WATER); - particle->isVisible = false; + if (effect->pos.y < (this->dyna.actor.world.pos.y - 10.0f)) { + EffectSsGSplash_Spawn(globalCtx, &effect->pos, NULL, NULL, 0, effect->scale * 200000.0f); + SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &effect->pos, 50, NA_SE_EV_BOMB_DROP_WATER); + effect->isEnabled = false; } - } else if (particle->position.y < (this->dyna.actor.world.pos.y - 10.0f)) { - Math_ApproachZeroF(&particle->scale, 0.2f, 0.001f); - if (particle->scale <= 0.0001f) { - particle->timer = 0; + } else if (effect->pos.y < (this->dyna.actor.world.pos.y - 10.0f)) { + Math_ApproachZeroF(&effect->scale, 0.2f, 0.001f); + if (effect->scale <= 0.0001f) { + effect->timer = 0; } } - if (particle->timer != 0) { - particle->timer--; + if (effect->timer != 0) { + effect->timer--; } else { - particle->isVisible = false; + effect->isEnabled = false; } } } } -void EnRaf_DrawParticles(EnRaf* this, GlobalContext* globalCtx) { +void EnRaf_DrawEffects(EnRaf* this, GlobalContext* globalCtx) { s16 i; - EnRafParticle* particle = this->particles; + EnRafEffect* effect = this->effects; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; OPEN_DISPS(gfxCtx); func_8012C28C(globalCtx->state.gfxCtx); - for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) { - if (particle->isVisible) { - Matrix_Translate(particle->position.x, particle->position.y, particle->position.z, MTXMODE_NEW); - Matrix_Scale(particle->scale, particle->scale, particle->scale, MTXMODE_APPLY); - Matrix_RotateXS(particle->rotation.x, MTXMODE_APPLY); - Matrix_RotateYS(particle->rotation.y, MTXMODE_APPLY); - Matrix_RotateZS(particle->rotation.z, MTXMODE_APPLY); + for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { + if (effect->isEnabled) { + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); + Matrix_RotateXS(effect->rotation.x, MTXMODE_APPLY); + Matrix_RotateYS(effect->rotation.y, MTXMODE_APPLY); + Matrix_RotateZS(effect->rotation.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gCarnivorousLilyPadParticleDL); diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.h b/src/overlays/actors/ovl_En_Raf/z_en_raf.h index f639244027..2fc92fb2bd 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.h +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.h @@ -11,7 +11,7 @@ typedef enum { /* 0 */ EN_RAF_TYPE_NORMAL, /* 1 */ EN_RAF_TYPE_DORMANT, // Spawns without trap, so it can't eat bombs/player - /* 2 */ EN_RAF_TYPE_NO_WATER_INTERACTIONS // Won't produce ripples, and particles won't produce splashes + /* 2 */ EN_RAF_TYPE_NO_WATER_INTERACTIONS // Won't produce ripples, and effects won't produce splashes } EnRafType; struct EnRaf; @@ -19,14 +19,16 @@ struct EnRaf; typedef void (*EnRafActionFunc)(struct EnRaf*, GlobalContext*); typedef struct { - /* 0x00 */ u8 isVisible; - /* 0x04 */ Vec3f position; + /* 0x00 */ u8 isEnabled; + /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f velocity; - /* 0x1C */ Vec3f acceleration; + /* 0x1C */ Vec3f accel; /* 0x28 */ Vec3s rotation; /* 0x30 */ f32 scale; /* 0x34 */ s16 timer; -} EnRafParticle; // size = 0x38 +} EnRafEffect; // size = 0x38 + +#define EN_RAF_EFFECT_COUNT 31 typedef struct EnRaf { /* 0x000 */ DynaPolyActor dyna; @@ -59,7 +61,7 @@ typedef struct EnRaf { /* 0x3CC */ s16 petalClearPixelSecondPassIndex; /* 0x3CE */ s16 teethClearPixelSecondPassIndex; /* 0x3D0 */ ColliderCylinder collider; - /* 0x41C */ EnRafParticle particles[31]; + /* 0x41C */ EnRafEffect effects[EN_RAF_EFFECT_COUNT]; } EnRaf; // size = 0xAE4 extern const ActorInit En_Raf_InitVars; diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index c90e5d8f8d..832000b0c9 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -66,7 +66,7 @@ static InitChainEntry sInitChain[] = { void ObjChan_InitChandelier(ObjChan* this2, GlobalContext* globalCtx); void ObjChan_InitPot(ObjChan* this, GlobalContext* globalCtx); -void ObjChan_CreateSmashParticles(ObjChan* this, GlobalContext* globalCtx); +void ObjChan_CreateSmashEffects(ObjChan* this, GlobalContext* globalCtx); void ObjChan_DrawPot(Actor* thisx, GlobalContext* globalCtx); void ObjChan_DrawFire(ObjChan* this, GlobalContext* globalCtx); @@ -305,7 +305,7 @@ void ObjChan_PotAction(ObjChan* this, GlobalContext* globalCtx) { } } if (potBreaks) { - ObjChan_CreateSmashParticles(this, globalCtx); + ObjChan_CreateSmashEffects(this, globalCtx); ((ObjChan*)this->actor.parent)->pots[this->myPotIndex] = NULL; SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_CHANDELIER_BROKEN); func_80BB9A1C((ObjChan*)this->actor.parent, 40.0f); @@ -321,7 +321,7 @@ void ObjChan_PotAction(ObjChan* this, GlobalContext* globalCtx) { } } -void ObjChan_CreateSmashParticles(ObjChan* this, GlobalContext* globalCtx) { +void ObjChan_CreateSmashEffects(ObjChan* this, GlobalContext* globalCtx) { s16 new_var = 0; s32 phi_s0; Vec3f spDC; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 6c0b5d2d73..6477dd98c2 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -6523,9 +6523,9 @@ 0x808E18A8:("EnEncount2_Die",), 0x808E18F8:("EnEncount2_Update",), 0x808E19C4:("EnEncount2_Draw",), - 0x808E1A24:("EnEncount2_InitParticles",), - 0x808E1B4C:("EnEncount2_UpdateParticles",), - 0x808E1C9C:("EnEncount2_DrawParticles",), + 0x808E1A24:("EnEncount2_InitEffects",), + 0x808E1B4C:("EnEncount2_UpdateEffects",), + 0x808E1C9C:("EnEncount2_DrawEffects",), 0x808E1FE0:("EnFireRock_Init",), 0x808E1FF0:("EnFireRock_Destroy",), 0x808E2000:("EnFireRock_Update",), @@ -9769,9 +9769,9 @@ 0x80A181B4:("EnRaf_Update",), 0x80A1859C:("EnRaf_TransformLimbDraw",), 0x80A18A08:("EnRaf_Draw",), - 0x80A18A90:("EnRaf_InitializeParticle",), - 0x80A18B8C:("EnRaf_UpdateParticles",), - 0x80A18DA0:("EnRaf_DrawParticles",), + 0x80A18A90:("EnRaf_InitializeEffect",), + 0x80A18B8C:("EnRaf_UpdateEffects",), + 0x80A18DA0:("EnRaf_DrawEffects",), 0x80A19740:("ObjFunen_Init",), 0x80A19778:("ObjFunen_Draw",), 0x80A19910:("ObjRaillift_UpdatePosition",), @@ -10308,9 +10308,9 @@ 0x80A3BC88:("EnBaguo_Update",), 0x80A3BE24:("EnBaguo_PostLimbDraw",), 0x80A3BE60:("EnBaguo_DrawBody",), - 0x80A3BF0C:("EnBaguo_InitializeParticle",), - 0x80A3C008:("EnBaguo_UpdateParticles",), - 0x80A3C17C:("EnBaguo_DrawRockParticles",), + 0x80A3BF0C:("EnBaguo_InitializeEffect",), + 0x80A3C008:("EnBaguo_UpdateEffects",), + 0x80A3C17C:("EnBaguo_DrawEffects",), 0x80A3C4E0:("func_80A3C4E0",), 0x80A3C560:("func_80A3C560",), 0x80A3C658:("func_80A3C658",), @@ -10908,7 +10908,7 @@ 0x80A6B3F8:("EnMushi2_Update",), 0x80A6B8D0:("EnMushi2_Draw",), 0x80A6BF90:("EnFall_Moon_AdjustScaleAndPosition",), - 0x80A6C1DC:("EnFall_RisingDebris_ResetParticles",), + 0x80A6C1DC:("EnFall_RisingDebris_ResetEffects",), 0x80A6C22C:("EnFall_Init",), 0x80A6C39C:("EnFall_Destroy",), 0x80A6C3AC:("EnFall_MoonsTear_GetTerminaFieldMoon",), @@ -10925,8 +10925,8 @@ 0x80A6D0DC:("EnFall_Update",), 0x80A6D100:("EnFall_FireBall_SetPerVertexAlpha",), 0x80A6D220:("EnFall_FireBall_Update",), - 0x80A6D444:("EnFall_RisingDebris_UpdateParticles",), - 0x80A6D504:("EnFall_RisingDebris_InitializeParticles",), + 0x80A6D444:("EnFall_RisingDebris_UpdateEffects",), + 0x80A6D504:("EnFall_RisingDebris_InitializeEffect",), 0x80A6D698:("EnFall_RisingDebris_Update",), 0x80A6D75C:("EnFall_FireRing_Update",), 0x80A6D88C:("EnFall_Moon_Draw",), @@ -13669,8 +13669,8 @@ 0x80B40100:("func_80B40100",), 0x80B40160:("func_80B40160",), 0x80B401F8:("func_80B401F8",), - 0x80B40308:("func_80B40308",), - 0x80B40394:("func_80B40394",), + 0x80B40308:("BgGoronOyu_UpdateWaterBoxInfo",), + 0x80B40394:("BgGoronOyu_SpawnEffects",), 0x80B4056C:("BgGoronOyu_Init",), 0x80B40628:("BgGoronOyu_Destroy",), 0x80B4065C:("BgGoronOyu_Update",), @@ -15380,7 +15380,7 @@ 0x80BB9F24:("ObjChan_ChandelierAction",), 0x80BBA2FC:("ObjChan_InitPot",), 0x80BBA314:("ObjChan_PotAction",), - 0x80BBA488:("ObjChan_CreateSmashParticles",), + 0x80BBA488:("ObjChan_CreateSmashEffects",), 0x80BBA738:("ObjChan_Update",), 0x80BBA78C:("ObjChan_Draw",), 0x80BBA894:("ObjChan_DrawPot",),