diff --git a/assets/xml/objects/object_niw.xml b/assets/xml/objects/object_niw.xml
index a74cbe7daf..4eafec9566 100644
--- a/assets/xml/objects/object_niw.xml
+++ b/assets/xml/objects/object_niw.xml
@@ -30,8 +30,8 @@
-
-
+
+
diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c
index a99af73468..18679d1954 100644
--- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c
+++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c
@@ -47,10 +47,10 @@ void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, GlobalContext* globalCt
void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* globalCtx);
void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx);
-void BgDyYoseizo_ParticleInit(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel,
- Color_RGB8* primColor, Color_RGB8* envColor, f32 scale, s16 life, s16 type);
-void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, GlobalContext* globalCtx);
-void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx);
+void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel,
+ Color_RGB8* primColor, Color_RGB8* envColor, f32 scale, s16 life, s16 type);
+void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, GlobalContext* globalCtx);
+void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, GlobalContext* globalCtx);
static s32 sUnusedGetItemIds[] = { GI_FARORES_WIND, GI_NAYRUS_LOVE, GI_DINS_FIRE };
@@ -97,71 +97,70 @@ void BgDyYoseizo_Init(Actor* thisx, GlobalContext* globalCtx2) {
void BgDyYoseizo_Destroy(Actor* this, GlobalContext* globalCtx) {
}
-static Color_RGB8 sParticlePrimColors[] = {
+static Color_RGB8 sEffectPrimColors[] = {
{ 255, 255, 255 }, { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 255, 170 },
{ 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 255, 170 },
};
-static Color_RGB8 sParticleEnvColors[] = {
+static Color_RGB8 sEffectEnvColors[] = {
{ 155, 255, 255 }, { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 100, 255 },
{ 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 100, 255, 255 },
};
-void BgDyYoseizo_SpawnParticles(BgDyYoseizo* this, GlobalContext* globalCtx, s16 type) {
- Vec3f particleInitVelocity = { 0.0f, 0.0f, 0.0f };
- Vec3f particleAccel;
- Vec3f particleInitPos;
- Color_RGB8 particlePrimColor;
- Color_RGB8 particleEnvColor;
+void BgDyYoseizo_SpawnEffects(BgDyYoseizo* this, GlobalContext* globalCtx, s16 type) {
+ Vec3f vel = { 0.0f, 0.0f, 0.0f };
+ Vec3f accel;
+ Vec3f pos;
+ Color_RGB8 primColor;
+ Color_RGB8 envColor;
f32 spawnPosVariation;
- s32 particleType;
- f32 particleScale;
+ s32 effectType;
+ f32 scale;
s32 i;
- s16 particleLife;
+ s16 life;
if (!(this->scale < 0.01f)) {
spawnPosVariation = this->scale * 3500.0f;
- particleAccel.x = Rand_ZeroOne() - 0.5f;
- particleAccel.y = Rand_ZeroOne() - 0.5f;
- particleAccel.z = Rand_ZeroOne() - 0.5f;
+ accel.x = Rand_ZeroOne() - 0.5f;
+ accel.y = Rand_ZeroOne() - 0.5f;
+ accel.z = Rand_ZeroOne() - 0.5f;
for (i = 0; i < 2; i++) {
if (type == 0) {
- particleType = 0;
- particleScale = 0.4f;
- particleLife = 90;
- particleInitPos.x = this->actor.world.pos.x;
- particleInitPos.y = this->actor.world.pos.y + spawnPosVariation +
- ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.5f));
- particleInitPos.z = this->actor.world.pos.z + 30.0f;
+ effectType = 0;
+ scale = 0.4f;
+ life = 90;
+ pos.x = this->actor.world.pos.x;
+ pos.y = this->actor.world.pos.y + spawnPosVariation +
+ ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.5f));
+ pos.z = this->actor.world.pos.z + 30.0f;
} else {
- particleLife = 50;
- particleType = type;
- particleScale = 0.2f;
- particleInitPos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f);
+ life = 50;
+ effectType = type;
+ scale = 0.2f;
+ pos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f);
if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) {
- particleInitPos.y = this->actor.world.pos.y + spawnPosVariation + 50.0f +
- ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.1f));
- particleInitPos.z = this->actor.world.pos.z + 30.0f;
+ pos.y = this->actor.world.pos.y + spawnPosVariation + 50.0f +
+ ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.1f));
+ pos.z = this->actor.world.pos.z + 30.0f;
} else {
- particleInitPos.y = this->actor.world.pos.y + spawnPosVariation - 30.0f +
- ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.1f));
- particleInitPos.z = this->actor.world.pos.z + 60.0f;
+ pos.y = this->actor.world.pos.y + spawnPosVariation - 30.0f +
+ ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.1f));
+ pos.z = this->actor.world.pos.z + 60.0f;
}
if (LINK_IS_ADULT) {
- particleInitPos.y += 20.0f;
+ pos.y += 20.0f;
}
}
- particlePrimColor.r = sParticlePrimColors[particleType].r;
- particlePrimColor.g = sParticlePrimColors[particleType].g;
- particlePrimColor.b = sParticlePrimColors[particleType].b;
- particleEnvColor.r = sParticleEnvColors[particleType].r;
- particleEnvColor.g = sParticleEnvColors[particleType].g;
- particleEnvColor.b = sParticleEnvColors[particleType].b;
- BgDyYoseizo_ParticleInit(this, &particleInitPos, &particleInitVelocity, &particleAccel, &particlePrimColor,
- &particleEnvColor, particleScale, particleLife, particleType);
+ primColor.r = sEffectPrimColors[effectType].r;
+ primColor.g = sEffectPrimColors[effectType].g;
+ primColor.b = sEffectPrimColors[effectType].b;
+ envColor.r = sEffectEnvColors[effectType].r;
+ envColor.g = sEffectEnvColors[effectType].g;
+ envColor.b = sEffectEnvColors[effectType].b;
+ BgDyYoseizo_SpawnEffect(this, &pos, &vel, &accel, &primColor, &envColor, scale, life, effectType);
}
}
}
@@ -341,7 +340,7 @@ void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx)
} else {
this->actor.shape.rot.y += 3000;
}
- BgDyYoseizo_SpawnParticles(this, globalCtx, 0);
+ BgDyYoseizo_SpawnEffects(this, globalCtx, 0);
}
void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) {
@@ -376,7 +375,7 @@ void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* glo
this->actor.textId = 0xDB;
this->dialogState = TEXT_STATE_EVENT;
Message_StartTextbox(globalCtx, this->actor.textId, NULL);
- BgDyYoseizo_SpawnParticles(this, globalCtx, 0);
+ BgDyYoseizo_SpawnEffects(this, globalCtx, 0);
this->actionFunc = BgDyYoseizo_GreetPlayer_NoReward;
}
@@ -397,7 +396,7 @@ void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCt
}
BgDyYoseizo_Bob(this, globalCtx);
- BgDyYoseizo_SpawnParticles(this, globalCtx, 0);
+ BgDyYoseizo_SpawnEffects(this, globalCtx, 0);
}
void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) {
@@ -506,7 +505,7 @@ void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, GlobalContext* globalCt
}
BgDyYoseizo_Bob(this, globalCtx);
- BgDyYoseizo_SpawnParticles(this, globalCtx, 0);
+ BgDyYoseizo_SpawnEffects(this, globalCtx, 0);
}
void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) {
@@ -540,7 +539,7 @@ void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f);
Math_ApproachF(&this->scaleFraction, 0.2f, 0.03f, 0.05f);
this->actor.shape.rot.y += 3000;
- BgDyYoseizo_SpawnParticles(this, globalCtx, 0);
+ BgDyYoseizo_SpawnEffects(this, globalCtx, 0);
}
}
}
@@ -645,7 +644,7 @@ void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, GlobalContext* glob
this->actionFunc = BgDyYoseizo_Give_Reward;
}
}
- BgDyYoseizo_SpawnParticles(this, globalCtx, 0);
+ BgDyYoseizo_SpawnEffects(this, globalCtx, 0);
}
static s16 sDemoEffectLightColors[] = { DEMO_EFFECT_LIGHT_GREEN, DEMO_EFFECT_LIGHT_RED, DEMO_EFFECT_LIGHT_BLUE };
@@ -693,7 +692,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) {
actionIndex = globalCtx->csCtx.npcActions[0]->action - 4;
if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) {
actionIndex++;
- BgDyYoseizo_SpawnParticles(this, globalCtx, actionIndex);
+ BgDyYoseizo_SpawnEffects(this, globalCtx, actionIndex);
} else if (!this->lightBallSpawned) {
demoEffectParams = ((s16)(sDemoEffectLightColors[actionIndex] << 0xC) | DEMO_EFFECT_LIGHT);
@@ -702,7 +701,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) {
this->lightBallSpawned = true;
}
} else {
- BgDyYoseizo_SpawnParticles(this, globalCtx, 0);
+ BgDyYoseizo_SpawnEffects(this, globalCtx, 0);
}
if ((globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) && (globalCtx->csCtx.npcActions[0]->action >= 10) &&
@@ -861,7 +860,7 @@ void BgDyYoseizo_Update(Actor* thisx, GlobalContext* globalCtx2) {
Actor_SetFocus(&this->actor, this->heightOffset);
this->actor.focus.pos.y = this->heightOffset;
func_80038290(globalCtx, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos);
- BgDyYoseizo_ParticleUpdate(this, globalCtx);
+ BgDyYoseizo_UpdateEffects(this, globalCtx);
Actor_SetScale(&this->actor, this->scale);
}
@@ -909,38 +908,38 @@ void BgDyYoseizo_Draw(Actor* thisx, GlobalContext* globalCtx) {
this->skelAnime.dListCount, BgDyYoseizo_OverrideLimbDraw, NULL, this);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1629);
- BgDyYoseizo_ParticleDraw(this, globalCtx);
+ BgDyYoseizo_DrawEffects(this, globalCtx);
}
-void BgDyYoseizo_ParticleInit(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel,
- Color_RGB8* primColor, Color_RGB8* envColor, f32 scale, s16 life, s16 type) {
- BgDyYoseizoParticle* particle;
+void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel,
+ Color_RGB8* primColor, Color_RGB8* envColor, f32 scale, s16 life, s16 type) {
+ BgDyYoseizoEffect* effect;
s16 i;
- particle = this->particles;
+ effect = this->effects;
- for (i = 0; i < 200; i++, particle++) {
- if (particle->alive == 0) {
- particle->alive = 1;
- particle->pos = *initPos;
- particle->velocity = *initVelocity;
- particle->accel = *accel;
- particle->primColor = *primColor;
- particle->alpha = 0;
- particle->envColor = *envColor;
- particle->scale = scale;
- particle->timer = life;
- particle->type = type;
- particle->pitch = 0.0f;
- particle->yaw = Rand_CenteredFloat(30000.0f);
- particle->roll = 0.0f;
+ for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) {
+ if (effect->alive == 0) {
+ effect->alive = 1;
+ effect->pos = *initPos;
+ effect->velocity = *initVelocity;
+ effect->accel = *accel;
+ effect->primColor = *primColor;
+ effect->alpha = 0;
+ effect->envColor = *envColor;
+ effect->scale = scale;
+ effect->timer = life;
+ effect->type = type;
+ effect->pitch = 0.0f;
+ effect->yaw = Rand_CenteredFloat(30000.0f);
+ effect->roll = 0.0f;
return;
}
}
}
-void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, GlobalContext* globalCtx) {
- BgDyYoseizoParticle* particle = this->particles;
+void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, GlobalContext* globalCtx) {
+ BgDyYoseizoEffect* effect = this->effects;
Player* player = GET_PLAYER(globalCtx);
Vec3f sp94;
Vec3f sp88;
@@ -948,17 +947,17 @@ void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, GlobalContext* globalCtx) {
f32 goalYaw;
s16 i = 0;
- for (i = 0; i < 200; i++, particle++) {
- if (particle->alive != 0) {
- particle->roll += 3000.0f;
+ for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) {
+ if (effect->alive != 0) {
+ effect->roll += 3000.0f;
- if (particle->type == 0) {
- particle->pos.x += particle->velocity.x;
- particle->pos.y += particle->velocity.y;
- particle->pos.z += particle->velocity.z;
- particle->velocity.x += particle->accel.x;
- particle->velocity.y += particle->accel.y;
- particle->velocity.z += particle->accel.z;
+ if (effect->type == 0) {
+ effect->pos.x += effect->velocity.x;
+ 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;
} else {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_HEALING - SFX_FLAG);
@@ -966,69 +965,69 @@ void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, GlobalContext* globalCtx) {
sp94.y = player->actor.world.pos.y - 150.0f;
sp94.z = player->actor.world.pos.z - 50.0f;
- goalPitch = Math_Vec3f_Pitch(&particle->pos, &sp94);
- goalYaw = Math_Vec3f_Yaw(&particle->pos, &sp94);
+ goalPitch = Math_Vec3f_Pitch(&effect->pos, &sp94);
+ goalYaw = Math_Vec3f_Yaw(&effect->pos, &sp94);
- Math_ApproachF(&particle->pitch, goalPitch, 0.9f, 5000.0f);
- Math_ApproachF(&particle->yaw, goalYaw, 0.9f, 5000.0f);
+ Math_ApproachF(&effect->pitch, goalPitch, 0.9f, 5000.0f);
+ Math_ApproachF(&effect->yaw, goalYaw, 0.9f, 5000.0f);
Matrix_Push();
- Matrix_RotateY(BINANG_TO_RAD_ALT(particle->yaw), MTXMODE_NEW);
- Matrix_RotateX(BINANG_TO_RAD_ALT(particle->pitch), MTXMODE_APPLY);
+ Matrix_RotateY(BINANG_TO_RAD_ALT(effect->yaw), MTXMODE_NEW);
+ Matrix_RotateX(BINANG_TO_RAD_ALT(effect->pitch), MTXMODE_APPLY);
sp94.x = sp94.y = sp94.z = 3.0f;
Matrix_MultVec3f(&sp94, &sp88);
Matrix_Pop();
- particle->pos.x += sp88.x;
- particle->pos.y += sp88.y;
- particle->pos.z += sp88.z;
+ effect->pos.x += sp88.x;
+ effect->pos.y += sp88.y;
+ effect->pos.z += sp88.z;
}
}
// fade up, fade down, vanish and reset
- if (particle->timer != 0) {
- particle->timer--;
- particle->alpha += 30;
+ if (effect->timer != 0) {
+ effect->timer--;
+ effect->alpha += 30;
- if (particle->alpha > 255) {
- particle->alpha = 255;
+ if (effect->alpha > 255) {
+ effect->alpha = 255;
}
} else {
- particle->alpha -= 30;
+ effect->alpha -= 30;
- if (particle->alpha <= 0) {
- particle->alpha = particle->alive = 0;
+ if (effect->alpha <= 0) {
+ effect->alpha = effect->alive = 0;
}
}
}
}
-void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx) {
+void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- u8 phi_s3 = 0;
- BgDyYoseizoParticle* particle = this->particles;
+ u8 materialFlag = 0;
+ BgDyYoseizoEffect* effect = this->effects;
s16 i;
OPEN_DISPS(gfxCtx, "../z_bg_dy_yoseizo.c", 1767);
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < 200; i++, particle++) {
- if (particle->alive == 1) {
- if (phi_s3 == 0) {
+ for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) {
+ if (effect->alive == 1) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleMaterialDL));
gDPPipeSync(POLY_XLU_DISP++);
- phi_s3++;
+ materialFlag++;
}
- gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, particle->primColor.r, particle->primColor.g, particle->primColor.b,
- particle->alpha);
- gDPSetEnvColor(POLY_XLU_DISP++, particle->envColor.r, particle->envColor.g, particle->envColor.b, 0);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, effect->primColor.r, effect->primColor.g, effect->primColor.b,
+ effect->alpha);
+ gDPSetEnvColor(POLY_XLU_DISP++, effect->envColor.r, effect->envColor.g, effect->envColor.b, 0);
- Matrix_Translate(particle->pos.x, particle->pos.y, particle->pos.z, MTXMODE_NEW);
+ Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
- Matrix_Scale(particle->scale, particle->scale, 1.0f, MTXMODE_APPLY);
- Matrix_RotateZ(particle->roll, MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);
+ Matrix_RotateZ(effect->roll, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_bg_dy_yoseizo.c", 1810),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h
index 59abc6065c..d77987077f 100644
--- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h
+++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h
@@ -10,6 +10,8 @@ struct BgDyYoseizo;
typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, GlobalContext*);
+#define BG_DY_YOSEIZO_EFFECT_COUNT 200
+
typedef struct {
/* 0x00 */ u8 alive; // drawn if 1, respawn if 0
/* 0x04 */ Vec3f pos;
@@ -24,7 +26,7 @@ typedef struct {
/* 0x36 */ f32 pitch;
/* 0x36 */ f32 yaw;
/* 0x40 */ f32 roll;
-} BgDyYoseizoParticle; // size = 0x44
+} BgDyYoseizoEffect; // size = 0x44
typedef struct BgDyYoseizo {
/* 0x0000 */ Actor actor;
@@ -67,7 +69,7 @@ typedef struct BgDyYoseizo {
/* 0x0340 */ EnDyExtra* beam;
/* 0x0344 */ EnExItem* item;
/* 0x0348 */ char unk_348[0x4C];
- /* 0x0394 */ BgDyYoseizoParticle particles[200];
+ /* 0x0394 */ BgDyYoseizoEffect effects[BG_DY_YOSEIZO_EFFECT_COUNT];
} BgDyYoseizo; // size = 0x38B4
#endif
diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c
index 69136d5bb3..fff7557b7a 100644
--- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c
+++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c
@@ -130,11 +130,11 @@ void func_808C1554(void* arg0, void* floorTex, s32 arg2, f32 arg3) {
}
}
-void func_808C17C8(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 arg5) {
+void func_808C17C8(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4, s16 countLimit) {
s16 i;
BossDodongoEffect* eff = (BossDodongoEffect*)globalCtx->specialEffects;
- for (i = 0; i < arg5; i++, eff++) {
+ for (i = 0; i < countLimit; i++, eff++) {
if (eff->unk_24 == 0) {
eff->unk_24 = 1;
eff->unk_00 = *arg1;
@@ -183,7 +183,7 @@ void BossDodongo_Init(Actor* thisx, GlobalContext* globalCtx) {
u16* temp_s2;
u32 temp_v0;
- globalCtx->specialEffects = &this->effects;
+ globalCtx->specialEffects = this->effects;
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 9200.0f, ActorShadow_DrawCircle, 250.0f);
Actor_SetScale(&this->actor, 0.01f);
@@ -991,7 +991,8 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) {
sp54.x = sinf(sp4C) * sp50 + (-890.0f);
sp54.y = -1513.76f;
sp54.z = cosf(sp4C) * sp50 + (-3304.0f);
- func_808C17C8(globalCtx, &sp54, &sp6C, &sp60, ((s16)Rand_ZeroFloat(2.0f)) + 6, 0x50);
+ func_808C17C8(globalCtx, &sp54, &sp6C, &sp60, ((s16)Rand_ZeroFloat(2.0f)) + 6,
+ BOSS_DODONGO_EFFECT_COUNT);
}
}
@@ -1645,7 +1646,7 @@ void BossDodongo_UpdateEffects(GlobalContext* globalCtx) {
s16 colorIndex;
s16 i;
- for (i = 0; i < 80; i++, eff++) {
+ for (i = 0; i < BOSS_DODONGO_EFFECT_COUNT; i++, eff++) {
if (eff->unk_24 != 0) {
eff->unk_00.x += eff->unk_0C.x;
eff->unk_00.y += eff->unk_0C.y;
@@ -1672,7 +1673,7 @@ void BossDodongo_UpdateEffects(GlobalContext* globalCtx) {
void BossDodongo_DrawEffects(GlobalContext* globalCtx) {
MtxF* unkMtx;
s16 i;
- u8 phi_s3 = 0;
+ u8 materialFlag = 0;
BossDodongoEffect* eff;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
@@ -1683,13 +1684,13 @@ void BossDodongo_DrawEffects(GlobalContext* globalCtx) {
func_80093D84(globalCtx->state.gfxCtx);
unkMtx = &globalCtx->billboardMtxF;
- for (i = 0; i < 80; i++, eff++) {
+ for (i = 0; i < BOSS_DODONGO_EFFECT_COUNT; i++, eff++) {
if (eff->unk_24 == 1) {
gDPPipeSync(POLY_XLU_DISP++);
- if (phi_s3 == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, object_kingdodongo_DL_009D50);
- phi_s3++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, eff->color.r, eff->color.g, eff->color.b, eff->alpha);
diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h
index 3bc07819e1..55d6075b71 100644
--- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h
+++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h
@@ -8,6 +8,8 @@ struct BossDodongo;
typedef void (*BossDodongoActionFunc)(struct BossDodongo*, GlobalContext*);
+#define BOSS_DODONGO_EFFECT_COUNT 80
+
typedef struct {
/* 0x00 */ Vec3f unk_00;
/* 0x0C */ Vec3f unk_0C;
@@ -95,7 +97,7 @@ typedef struct BossDodongo {
/* 0x0434 */ Vec3f cameraAt;
/* 0x0440 */ ColliderJntSph collider;
/* 0x0460 */ ColliderJntSphElement items[19];
- /* 0x0920 */ BossDodongoEffect effects[80];
+ /* 0x0920 */ BossDodongoEffect effects[BOSS_DODONGO_EFFECT_COUNT];
} BossDodongo; // size = 0x1820
#endif
diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c
index d977e8f7f6..a313eae0a0 100644
--- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c
+++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c
@@ -1433,7 +1433,7 @@ void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx) {
s16 i1;
s16 i2;
- for (i1 = 0; i1 < 180; i1++, effect++) {
+ for (i1 = 0; i1 < BOSSFD_EFFECT_COUNT; i1++, effect++) {
if (effect->type != BFD_FX_NONE) {
effect->timer1++;
@@ -1512,19 +1512,19 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) {
static void* dustTex[] = {
gDust1Tex, gDust1Tex, gDust2Tex, gDust3Tex, gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex,
};
- u8 flag = false;
+ u8 materialFlag = 0;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s16 i;
BossFdEffect* firstEffect = effect;
OPEN_DISPS(gfxCtx, "../z_boss_fd.c", 4023);
- for (i = 0; i < 180; i++, effect++) {
+ for (i = 0; i < BOSSFD_EFFECT_COUNT; i++, effect++) {
if (effect->type == BFD_FX_EMBER) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D84(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, gVolvagiaEmberMaterialDL);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, effect->color.r, effect->color.g, effect->color.b, effect->alpha);
@@ -1539,13 +1539,13 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) {
}
effect = firstEffect;
- flag = false;
- for (i = 0; i < 180; i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < BOSSFD_EFFECT_COUNT; i++, effect++) {
if (effect->type == BFD_FX_DEBRIS) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D18(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_OPA_DISP++, gVolvagiaDebrisMaterialDL);
- flag++;
+ materialFlag++;
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
@@ -1560,15 +1560,15 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) {
}
effect = firstEffect;
- flag = false;
- for (i = 0; i < 180; i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < BOSSFD_EFFECT_COUNT; i++, effect++) {
if (effect->type == BFD_FX_DUST) {
- if (!flag) {
+ if (materialFlag == 0) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
gSPDisplayList(POLY_XLU_DISP++, gVolvagiaDustMaterialDL);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 90, 30, 0, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 90, 30, 0, 0);
- flag++;
+ materialFlag++;
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
@@ -1583,14 +1583,14 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) {
}
effect = firstEffect;
- flag = false;
- for (i = 0; i < 180; i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < BOSSFD_EFFECT_COUNT; i++, effect++) {
if (effect->type == BFD_FX_FIRE_BREATH) {
- if (!flag) {
+ if (materialFlag == 0) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
gSPDisplayList(POLY_XLU_DISP++, gVolvagiaDustMaterialDL);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 10, 0, 255);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, effect->alpha);
@@ -1606,13 +1606,13 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) {
}
effect = firstEffect;
- flag = false;
- for (i = 0; i < 180; i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < BOSSFD_EFFECT_COUNT; i++, effect++) {
if (effect->type == BFD_FX_SKULL_PIECE) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D84(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, gVolvagiaSkullPieceMaterialDL);
- flag++;
+ materialFlag++;
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h
index ea24fd346e..223f9ae485 100644
--- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h
+++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h
@@ -36,6 +36,8 @@ typedef enum {
/* 6 */ BFD_CS_EMERGE
} BossFdCutsceneState;
+#define BOSSFD_EFFECT_COUNT 180
+
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
@@ -51,8 +53,6 @@ typedef struct {
/* 0x38 */ f32 bFdFxFloat2;
} BossFdEffect; // size = 0x3C
-#define BOSSFD_EFFECT_COUNT 180
-
#define vFdFxRotX bFdFxFloat1
#define vFdFxScaleMod bFdFxFloat1
#define vFdFxRotY bFdFxFloat2
@@ -179,7 +179,7 @@ typedef struct BossFd {
/* 0x1408 */ BossFdCam camData;
/* 0x1490 */ ColliderJntSph collider;
/* 0x14B0 */ ColliderJntSphElement elements[19];
- /* 0x1970 */ BossFdEffect effects[180];
+ /* 0x1970 */ BossFdEffect effects[BOSSFD_EFFECT_COUNT];
} BossFd; // size = 0x43A0
#endif
diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
index 85ce544881..7c4d4a1777 100644
--- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
+++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
@@ -110,6 +110,8 @@ static BossGanon* sGanondorf;
static EnZl3* sZelda;
+#define BOSSGANON_EFFECT_COUNT 200
+
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 timer;
@@ -128,7 +130,7 @@ typedef struct {
/* 0x48 */ f32 unk_48; // mostly y rot
} GanondorfEffect; // size = 0x4C
-GanondorfEffect sEffectBuf[200];
+GanondorfEffect sEffects[BOSSGANON_EFFECT_COUNT];
void BossGanonEff_SpawnWindowShard(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, f32 scale) {
static Color_RGB8 shardColors[] = { { 255, 175, 85 }, { 155, 205, 155 }, { 155, 125, 55 } };
@@ -343,10 +345,10 @@ void BossGanon_Init(Actor* thisx, GlobalContext* globalCtx2) {
if (thisx->params < 0x64) {
Flags_SetSwitch(globalCtx, 0x14);
- globalCtx->specialEffects = sEffectBuf;
+ globalCtx->specialEffects = sEffects;
- for (i = 0; i < ARRAY_COUNT(sEffectBuf); i++) {
- sEffectBuf[i].type = GDF_EFF_NONE;
+ for (i = 0; i < BOSSGANON_EFFECT_COUNT; i++) {
+ sEffects[i].type = GDF_EFF_NONE;
}
sGanondorf = this;
@@ -4610,7 +4612,7 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) {
spA0.x = 0.0f;
spA0.y = 0.0f;
- for (i = 0; i < ARRAY_COUNT(sEffectBuf); i++, eff++) {
+ for (i = 0; i < BOSSGANON_EFFECT_COUNT; i++, eff++) {
if (eff->type != GDF_EFF_NONE) {
eff->pos.x += eff->velocity.x;
eff->pos.y += eff->velocity.y;
@@ -4808,7 +4810,7 @@ static u8 sLightningEnvColors[] = {
};
void BossGanon_DrawEffects(GlobalContext* globalCtx) {
- u8 flag = 0;
+ u8 materialFlag = 0;
s16 i;
s32 pad;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
@@ -4821,9 +4823,9 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) {
for (i = 0; i < 200; i++, eff++) {
if (eff->type == GDF_EFF_WINDOW_SHARD) {
gDPPipeSync(POLY_OPA_DISP++);
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_OPA_DISP++, gDorfWindowShardMaterialDL);
- flag++;
+ materialFlag++;
}
if ((eff->timer & 7) != 0) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, eff->color.r, eff->color.g, eff->color.b, 255);
@@ -4841,15 +4843,15 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) {
}
eff = effFirst;
- flag = 0;
+ materialFlag = 0;
for (i = 0; i < 150; i++, eff++) {
if (eff->type == GDF_EFF_SPARKLE) {
gDPPipeSync(POLY_XLU_DISP++);
- if (flag == 0) {
+ if (materialFlag == 0) {
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 0);
gSPDisplayList(POLY_XLU_DISP++, gDorfLightBallMaterialDL);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, eff->alpha);
Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW);
@@ -4863,15 +4865,15 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) {
}
eff = effFirst;
- flag = 0;
+ materialFlag = 0;
for (i = 0; i < 150; i++, eff++) {
if (eff->type == GDF_EFF_LIGHT_RAY) {
gDPPipeSync(POLY_XLU_DISP++);
- if (flag == 0) {
+ if (materialFlag == 0) {
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 0);
gSPDisplayList(POLY_XLU_DISP++, gDorfLightBallMaterialDL);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, eff->alpha);
Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW);
@@ -4887,11 +4889,11 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) {
}
eff = effFirst;
- flag = 0;
+ materialFlag = 0;
for (i = 0; i < 150; i++, eff++) {
if (eff->type == GDF_EFF_SHOCK) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gDPPipeSync(POLY_XLU_DISP++);
if (eff->unk_2E == GDF_SHOCK_PLAYER_PURPLE) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 0, 200, 255);
@@ -4900,7 +4902,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 0);
}
- flag++;
+ materialFlag++;
}
Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW);
Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY);
diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c
index 04a27e1c12..1d84580196 100644
--- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c
+++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c
@@ -26,8 +26,8 @@ void func_80900580(BossGanon2* this, GlobalContext* globalCtx);
void func_80900650(BossGanon2* this, GlobalContext* globalCtx);
void func_80900890(BossGanon2* this, GlobalContext* globalCtx);
void func_8090120C(BossGanon2* this, GlobalContext* globalCtx);
-void func_80905DA8(BossGanon2* this, GlobalContext* globalCtx);
-void func_809060E8(GlobalContext* globalCtx);
+void BossGanon2_UpdateEffects(BossGanon2* this, GlobalContext* globalCtx);
+void BossGanon2_DrawEffects(GlobalContext* globalCtx);
void BossGanon2_GenShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx);
void BossGanon2_DrawShadowTexture(void* shadowTexture, BossGanon2* this, GlobalContext* globalCtx);
@@ -92,25 +92,25 @@ void BossGanon2_SetObjectSegment(BossGanon2* this, GlobalContext* globalCtx, s32
}
void func_808FD210(GlobalContext* globalCtx, Vec3f* arg1) {
- BossGanon2Effect* effect = globalCtx->specialEffects;
+ BossGanon2Effect* effects = globalCtx->specialEffects;
- effect->type = 1;
- effect->position = *arg1;
- effect->unk_2E = 0;
- effect->unk_01 = 0;
- effect->velocity.x = 25.0f;
- effect->velocity.y = 15.0f;
- effect->velocity.z = 0.0f;
- effect->accel.x = 0.0f;
- effect->accel.y = -1.0f;
- effect->accel.z = 0.0f;
+ effects[0].type = 1;
+ effects[0].position = *arg1;
+ effects[0].unk_2E = 0;
+ effects[0].unk_01 = 0;
+ effects[0].velocity.x = 25.0f;
+ effects[0].velocity.y = 15.0f;
+ effects[0].velocity.z = 0.0f;
+ effects[0].accel.x = 0.0f;
+ effects[0].accel.y = -1.0f;
+ effects[0].accel.z = 0.0f;
}
void func_808FD27C(GlobalContext* globalCtx, Vec3f* position, Vec3f* velocity, f32 scale) {
BossGanon2Effect* effect = globalCtx->specialEffects;
s16 i;
- for (i = 0; i < ARRAY_COUNT(sParticles); i++, effect++) {
+ for (i = 0; i < BOSS_GANON2_EFFECT_COUNT; i++, effect++) {
if (effect->type == 0) {
effect->type = 2;
effect->position = *position;
@@ -132,10 +132,10 @@ void BossGanon2_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
s16 i;
- globalCtx->specialEffects = sParticles;
+ globalCtx->specialEffects = sEffects;
- for (i = 0; i < ARRAY_COUNT(sParticles); i++) {
- sParticles[i].type = 0;
+ for (i = 0; i < BOSS_GANON2_EFFECT_COUNT; i++) {
+ sEffects[i].type = 0;
}
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
@@ -737,12 +737,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
case 24:
SkelAnime_Update(&this->skelAnime);
if (1) {
- BossGanon2Effect* effect = globalCtx->specialEffects;
+ BossGanon2Effect* effects = globalCtx->specialEffects;
- this->unk_3B0 = effect->position;
- this->unk_3A4.x = effect->position.x + 70.0f;
- this->unk_3A4.y = effect->position.y - 30.0f;
- this->unk_3A4.z = effect->position.z + 70.0f;
+ this->unk_3B0 = effects[0].position;
+ this->unk_3A4.x = effects[0].position.x + 70.0f;
+ this->unk_3A4.y = effects[0].position.y - 30.0f;
+ this->unk_3A4.z = effects[0].position.z + 70.0f;
}
if ((this->unk_398 & 3) == 0) {
func_80078884(NA_SE_IT_SWORD_SWING);
@@ -762,15 +762,15 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) {
this->unk_3B0.y = ((player->actor.world.pos.y + 10.0f + 60.0f) - 20.0f) - 3.0f;
this->unk_3B0.z = (player->actor.world.pos.z - 40.0f) - 10.0f;
if (this->unk_398 == 10) {
- BossGanon2Effect* effect = globalCtx->specialEffects;
+ BossGanon2Effect* effects = globalCtx->specialEffects;
- effect->unk_2E = 1;
- effect->position.x = sZelda->actor.world.pos.x + 50.0f + 10.0f;
- effect->position.y = sZelda->actor.world.pos.y + 350.0f;
- effect->position.z = sZelda->actor.world.pos.z - 25.0f;
- effect->velocity.x = 0.0f;
- effect->velocity.z = 0.0f;
- effect->velocity.y = -30.0f;
+ effects[0].unk_2E = 1;
+ effects[0].position.x = sZelda->actor.world.pos.x + 50.0f + 10.0f;
+ effects[0].position.y = sZelda->actor.world.pos.y + 350.0f;
+ effects[0].position.z = sZelda->actor.world.pos.z - 25.0f;
+ effects[0].velocity.x = 0.0f;
+ effects[0].velocity.z = 0.0f;
+ effects[0].velocity.y = -30.0f;
this->unk_39C = 26;
this->unk_398 = 0;
} else {
@@ -2164,7 +2164,7 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) {
if (D_80906D78 != 0) {
D_80906D78 = 0;
- for (i2 = 0; i2 < ARRAY_COUNT(sParticles); i2++) {
+ for (i2 = 0; i2 < 100; i2++) {
angle = Rand_ZeroFloat(2 * M_PI);
sp44 = Rand_ZeroFloat(40.0f) + 10.0f;
sp58 = this->actor.world.pos;
@@ -2178,7 +2178,7 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
this->unk_388 += 0.15f;
- func_80905DA8(this, globalCtx);
+ BossGanon2_UpdateEffects(this, globalCtx);
}
void func_809034E4(Vec3f* arg0, Vec3f* arg1) {
@@ -2812,17 +2812,17 @@ void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5983);
- func_809060E8(globalCtx);
+ BossGanon2_DrawEffects(globalCtx);
}
-void func_80905DA8(BossGanon2* this, GlobalContext* globalCtx) {
+void BossGanon2_UpdateEffects(BossGanon2* this, GlobalContext* globalCtx) {
s32 pad[5];
Player* player = GET_PLAYER(globalCtx);
BossGanon2Effect* effect = globalCtx->specialEffects;
Vec3f sp78;
s16 i;
- for (i = 0; i < ARRAY_COUNT(sParticles); i++, effect++) {
+ for (i = 0; i < BOSS_GANON2_EFFECT_COUNT; i++, effect++) {
if (effect->type != 0) {
effect->position.x += effect->velocity.x;
effect->position.y += effect->velocity.y;
@@ -2877,9 +2877,9 @@ void func_80905DA8(BossGanon2* this, GlobalContext* globalCtx) {
}
}
-void func_809060E8(GlobalContext* globalCtx) {
+void BossGanon2_DrawEffects(GlobalContext* globalCtx) {
s16 alpha;
- u8 usingObjectGEff = false;
+ u8 objectFlag = 0;
BossGanon2Effect* effect;
s16 i;
BossGanon2Effect* effects;
@@ -2930,11 +2930,11 @@ void func_809060E8(GlobalContext* globalCtx) {
effect = effects;
- for (i = 0; i < ARRAY_COUNT(sParticles); i++, effect++) {
+ for (i = 0; i < BOSS_GANON2_EFFECT_COUNT; i++, effect++) {
if (effect->type == 2) {
- if (!usingObjectGEff) {
+ if (objectFlag == 0) {
BossGanon2_SetObjectSegment(NULL, globalCtx, OBJECT_GEFF, true);
- usingObjectGEff++;
+ objectFlag++;
}
Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW);
Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY);
diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.c
index 3f36cf19a5..46b6fb5089 100644
--- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.c
+++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2_data.c
@@ -2,6 +2,8 @@
#include "overlays/actors/ovl_En_Zl3/z_en_zl3.h"
#include "objects/object_ganon2/object_ganon2.h"
+#define BOSS_GANON2_EFFECT_COUNT 100
+
typedef struct {
/* 0x00 */ u8 type;
/* 0x01 */ u8 unk_01;
@@ -340,7 +342,7 @@ static Actor* D_8090EB30;
// unused
static UNK_TYPE D_8090EB34;
-static BossGanon2Effect sParticles[100];
+static BossGanon2Effect sEffects[BOSS_GANON2_EFFECT_COUNT];
static s32 sSeed1;
static s32 sSeed2;
diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c
index 286eebe9c9..394045a7ad 100644
--- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c
+++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c
@@ -898,7 +898,7 @@ void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) {
Matrix_Push();
Matrix_RotateY(BINANG_TO_RAD_ALT(thisx->shape.rot.y), MTXMODE_NEW);
Matrix_RotateX(BINANG_TO_RAD_ALT(thisx->shape.rot.x), MTXMODE_APPLY);
- Matrix_RotateZ(BINANG_TO_RAD_ALT(this->work[GND_PARTICLE_ANGLE]), MTXMODE_APPLY);
+ Matrix_RotateZ(BINANG_TO_RAD_ALT(this->work[GND_EFFECT_ANGLE]), MTXMODE_APPLY);
Matrix_MultVec3f(&baseOffset, &offset);
Matrix_Pop();
pos.x = this->spearTip.x + offset.x;
@@ -911,7 +911,7 @@ void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) {
accel.y = (offset.y * -50.0f) / 1000.0f;
accel.z = (offset.z * -50.0f) / 1000.0f;
EffectSsFhgFlash_SpawnLightBall(globalCtx, &pos, &vel, &accel, 150, i % 7);
- this->work[GND_PARTICLE_ANGLE] += 0x1A5C;
+ this->work[GND_EFFECT_ANGLE] += 0x1A5C;
}
}
diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h
index 8b0616baca..5621821a1d 100644
--- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h
+++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h
@@ -42,7 +42,7 @@ typedef enum {
/* 9 */ GND_THROW_COUNT,
/* 10 */ GND_MASK_OFF,
/* 11 */ GND_EYE_STATE,
- /* 12 */ GND_PARTICLE_ANGLE,
+ /* 12 */ GND_EFFECT_ANGLE,
/* 13 */ GND_BODY_DECAY_INDEX,
/* 14 */ GND_BODY_DECAY_FLAG,
/* 15 */ GND_LIMB_DECAY_INDEX,
diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c
index ba5979d428..13d1ab6ec6 100644
--- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c
+++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c
@@ -18,6 +18,8 @@
((tent != NULL) && \
((tent->work[MO_TENT_ACTION_STATE] == MO_TENT_GRAB) || (tent->work[MO_TENT_ACTION_STATE] == MO_TENT_SHAKE)))
+#define BOSS_MO_EFFECT_COUNT 300
+
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f vel;
@@ -140,7 +142,7 @@ static f32 sFlatWidth[41] = {
#include "z_boss_mo_colchk.c"
-static BossMoEffect sEffects[300];
+static BossMoEffect sEffects[BOSS_MO_EFFECT_COUNT];
static s32 sSeed1;
static s32 sSeed2;
static s32 sSeed3;
@@ -184,12 +186,12 @@ s32 BossMo_NearLand(Vec3f* pos, f32 margin) {
return false;
}
-void BossMo_SpawnRipple(BossMoEffect* effect, Vec3f* pos, f32 scale, f32 maxScale, s16 maxAlpha, s16 partLimit,
+void BossMo_SpawnRipple(BossMoEffect* effect, Vec3f* pos, f32 scale, f32 maxScale, s16 maxAlpha, s16 countLimit,
u8 type) {
static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
s16 i;
- for (i = 0; i < partLimit; i++, effect++) {
+ for (i = 0; i < countLimit; i++, effect++) {
if (effect->type == MO_FX_NONE) {
effect->stopTimer = 0;
effect->type = type;
@@ -335,7 +337,7 @@ void BossMo_Init(Actor* thisx, GlobalContext* globalCtx2) {
MO_WATER_LEVEL(globalCtx) = this->waterLevel = MO_WATER_LEVEL(globalCtx);
globalCtx->roomCtx.unk_74[0] = 0xA0;
globalCtx->specialEffects = sEffects;
- for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
+ for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++) {
sEffects[i].type = MO_FX_NONE;
}
this->actor.world.pos.x = 200.0f;
@@ -2751,7 +2753,7 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) {
Vec3f bubbleSpeed = { 0.0f, 0.0f, 0.0f };
Vec3f bubbleVel;
- for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
+ for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++, effect++) {
if (effect->type != MO_FX_NONE) {
effect->timer++;
if (effect->stopTimer == 0) {
@@ -2896,7 +2898,7 @@ void BossMo_UpdateEffects(BossMo* this, GlobalContext* globalCtx) {
}
void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) {
- u8 flag = 0;
+ u8 materialFlag = 0;
s16 i;
s32 pad;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
@@ -2905,14 +2907,14 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) {
OPEN_DISPS(gfxCtx, "../z_boss_mo.c", 7264);
Matrix_Push();
- for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
+ for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++, effect++) {
if (effect->type == MO_FX_BIG_RIPPLE) {
- if (flag == 0) {
+ if (materialFlag == 0) {
func_80094BC4(gfxCtx);
gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 255, 0);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->alpha);
@@ -2927,15 +2929,15 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- flag = 0;
- for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++, effect++) {
if (effect->type == MO_FX_SMALL_RIPPLE) {
- if (flag == 0) {
+ if (materialFlag == 0) {
func_80093D84(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 255, 0);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->alpha);
@@ -2950,18 +2952,18 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- flag = 0;
- for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++, effect++) {
if (((effect->type == MO_FX_DROPLET) || (effect->type == MO_FX_SPLASH)) ||
(effect->type == MO_FX_SPLASH_TRAIL)) {
- if (flag == 0) {
+ if (materialFlag == 0) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gDust1Tex));
gSPDisplayList(POLY_XLU_DISP++, gMorphaDropletMaterialDL);
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s16)effect->fwork[MO_FX_SHIMMER], (s16)effect->fwork[MO_FX_SHIMMER],
@@ -2979,17 +2981,17 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- flag = 0;
- for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++, effect++) {
if (effect->type == MO_FX_WET_SPOT) {
- if (flag == 0) {
+ if (materialFlag == 0) {
func_80094044(gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gDust1Tex));
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0);
gSPDisplayList(POLY_XLU_DISP++, gMorphaDropletMaterialDL);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s16)effect->fwork[MO_FX_SHIMMER], (s16)effect->fwork[MO_FX_SHIMMER],
@@ -3005,15 +3007,15 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- flag = 0;
- for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < BOSS_MO_EFFECT_COUNT; i++, effect++) {
if (effect->type == MO_FX_BUBBLE) {
- if (flag == 0) {
+ if (materialFlag == 0) {
func_80093D18(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_OPA_DISP++, 150, 150, 150, 0);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, effect->alpha);
diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c
index 6db8b63200..e2ba71adf4 100644
--- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c
+++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c
@@ -52,8 +52,8 @@ void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx);
void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx);
void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx);
void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx);
-void BossSst_UpdateEffect(Actor* thisx, GlobalContext* globalCtx);
-void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx);
+void BossSst_UpdateEffects(Actor* thisx, GlobalContext* globalCtx);
+void BossSst_DrawEffects(Actor* thisx, GlobalContext* globalCtx);
void BossSst_HeadSfx(BossSst* this, u16 sfxId);
@@ -1154,7 +1154,7 @@ void BossSst_HeadMelt(BossSst* this, GlobalContext* globalCtx) {
}
void BossSst_HeadSetupFinish(BossSst* this) {
- this->actor.draw = BossSst_DrawEffect;
+ this->actor.draw = BossSst_DrawEffects;
this->timer = 40;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
BossSst_SetCameraTargets(1.0 / 40, 6);
@@ -2235,7 +2235,7 @@ void BossSst_HandMelt(BossSst* this, GlobalContext* globalCtx) {
}
void BossSst_HandSetupFinish(BossSst* this) {
- this->actor.draw = BossSst_DrawEffect;
+ this->actor.draw = BossSst_DrawEffects;
this->timer = 20;
this->effects[0].status = 0;
this->actionFunc = BossSst_HandFinish;
@@ -2621,7 +2621,7 @@ void BossSst_UpdateHand(Actor* thisx, GlobalContext* globalCtx) {
trail->yRotMod = this->handYRotMod;
this->trailIndex = (this->trailIndex + 1) % 7;
- BossSst_UpdateEffect(&this->actor, globalCtx);
+ BossSst_UpdateEffects(&this->actor, globalCtx);
}
void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) {
@@ -2673,7 +2673,7 @@ void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) {
BossSst_HeadSfx(this, NA_SE_EN_SHADEST_MOVE - SFX_FLAG);
}
- BossSst_UpdateEffect(&this->actor, globalCtx);
+ BossSst_UpdateEffects(&this->actor, globalCtx);
}
s32 BossSst_OverrideHandDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
@@ -2759,7 +2759,7 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_sst.c", 6654);
- BossSst_DrawEffect(&this->actor, globalCtx);
+ BossSst_DrawEffects(&this->actor, globalCtx);
}
s32 BossSst_OverrideHeadDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx,
@@ -2927,7 +2927,7 @@ void BossSst_DrawHead(Actor* thisx, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_boss_sst.c", 6941);
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->viewProjectionMtxF, &this->actor.focus.pos, &this->center);
- BossSst_DrawEffect(&this->actor, globalCtx);
+ BossSst_DrawEffects(&this->actor, globalCtx);
}
void BossSst_SpawnHeadShadow(BossSst* this) {
@@ -3086,7 +3086,7 @@ void BossSst_IceShatter(BossSst* this) {
}
}
-void BossSst_UpdateEffect(Actor* thisx, GlobalContext* globalCtx) {
+void BossSst_UpdateEffects(Actor* thisx, GlobalContext* globalCtx) {
BossSst* this = (BossSst*)thisx;
BossSstEffect* effect;
s32 i;
@@ -3147,7 +3147,7 @@ void BossSst_UpdateEffect(Actor* thisx, GlobalContext* globalCtx) {
}
}
-void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) {
+void BossSst_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
BossSst* this = (BossSst*)thisx;
s32 i;
diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h
index 8b2b311d6e..1d7ab7d85a 100644
--- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h
+++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.h
@@ -8,6 +8,7 @@ struct BossSst;
typedef void (*BossSstActionFunc)(struct BossSst*, GlobalContext*);
+#define BOSS_SST_EFFECT_COUNT 18
typedef struct {
/* 0x0000 */ Vec3f pos;
@@ -47,7 +48,7 @@ typedef struct BossSst {
/* 0x03D4 */ ColliderJntSph colliderJntSph;
/* 0x03F4 */ ColliderJntSphElement colliderItems[11];
/* 0x06B4 */ ColliderCylinder colliderCyl;
- /* 0x0700 */ BossSstEffect effects[18];
+ /* 0x0700 */ BossSstEffect effects[BOSS_SST_EFFECT_COUNT];
/* 0x09D0 */ s16 trailIndex;
/* 0x09D2 */ s16 trailCount;
/* 0x09D4 */ BossSstHandTrail handTrails[7];
diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c
index 4aedf5fe55..71f51d3a6b 100644
--- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c
+++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c
@@ -45,6 +45,8 @@ typedef enum {
/* 0x69 */ TW_DEATHBALL_KOUME
} TwinrovaType;
+#define BOSS_TW_EFFECT_COUNT 150
+
typedef struct {
/* 0x0000 */ u8 type;
/* 0x0001 */ u8 frame;
@@ -229,7 +231,7 @@ static u8 D_8094C878;
static s16 D_8094C87A;
static s16 D_8094C87C;
static u8 D_8094C87E;
-static BossTwEffect sTwEffects[150];
+static BossTwEffect sEffects[BOSS_TW_EFFECT_COUNT];
void BossTw_AddDotEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* initalSpeed, Vec3f* accel, f32 scale,
s16 args, s16 countLimit) {
@@ -272,11 +274,11 @@ void BossTw_AddDmgCloud(GlobalContext* globalCtx, s16 type, Vec3f* initialPos, V
}
void BossTw_AddRingEffect(GlobalContext* globalCtx, Vec3f* initalPos, f32 scale, f32 arg3, s16 alpha, s16 args,
- s16 arg6, s16 arg7) {
+ s16 arg6, s16 countLimit) {
s16 i;
BossTwEffect* eff;
- for (i = 0, eff = globalCtx->specialEffects; i < arg7; i++, eff++) {
+ for (i = 0, eff = globalCtx->specialEffects; i < countLimit; i++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_RING;
eff->pos = *initalPos;
@@ -298,7 +300,7 @@ void BossTw_AddPlayerFreezeEffect(GlobalContext* globalCtx, Actor* target) {
BossTwEffect* eff;
s16 i;
- for (eff = globalCtx->specialEffects, i = 0; i < ARRAY_COUNT(sTwEffects); i++, eff++) {
+ for (eff = globalCtx->specialEffects, i = 0; i < BOSS_TW_EFFECT_COUNT; i++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_PLYR_FRZ;
eff->curSpeed = sZeroVector;
@@ -323,7 +325,7 @@ void BossTw_AddFlameEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec3f* in
s16 i;
BossTwEffect* eff;
- for (i = 0, eff = globalCtx->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) {
+ for (i = 0, eff = globalCtx->specialEffects; i < BOSS_TW_EFFECT_COUNT; i++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_FLAME;
eff->pos = *initalPos;
@@ -343,7 +345,7 @@ void BossTw_AddMergeFlameEffect(GlobalContext* globalCtx, Vec3f* initialPos, f32
s16 i;
BossTwEffect* eff;
- for (i = 0, eff = globalCtx->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) {
+ for (i = 0, eff = globalCtx->specialEffects; i < BOSS_TW_EFFECT_COUNT; i++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_MERGEFLAME;
eff->pos = *initialPos;
@@ -366,7 +368,7 @@ void BossTw_AddShieldBlastEffect(GlobalContext* globalCtx, Vec3f* initalPos, Vec
s16 i;
BossTwEffect* eff;
- for (i = 0, eff = globalCtx->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) {
+ for (i = 0, eff = globalCtx->specialEffects; i < BOSS_TW_EFFECT_COUNT; i++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_SHLD_BLST;
eff->pos = *initalPos;
@@ -393,7 +395,7 @@ void BossTw_AddShieldDeflectEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2)
sShieldHitYaw = player->actor.shape.rot.y;
for (i = 0; i < 8; i++) {
- for (eff = globalCtx->specialEffects, j = 0; j < ARRAY_COUNT(sTwEffects); j++, eff++) {
+ for (eff = globalCtx->specialEffects, j = 0; j < BOSS_TW_EFFECT_COUNT; j++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_SHLD_DEFL;
eff->pos = sShieldHitPos;
@@ -423,7 +425,7 @@ void BossTw_AddShieldHitEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) {
sShieldHitYaw = player->actor.shape.rot.y;
for (i = 0; i < 8; i++) {
- for (eff = globalCtx->specialEffects, j = 0; j < ARRAY_COUNT(sTwEffects); j++, eff++) {
+ for (eff = globalCtx->specialEffects, j = 0; j < BOSS_TW_EFFECT_COUNT; j++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_SHLD_HIT;
eff->pos = sShieldHitPos;
@@ -500,10 +502,10 @@ void BossTw_Init(Actor* thisx, GlobalContext* globalCtx2) {
D_8094C858 = D_8094C854 = 0.0f;
sFixedBlastType = Rand_ZeroFloat(1.99f);
- globalCtx->specialEffects = sTwEffects;
+ globalCtx->specialEffects = sEffects;
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
- sTwEffects[i].type = TWEFF_NONE;
+ for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
+ sEffects[i].type = TWEFF_NONE;
}
}
@@ -734,7 +736,7 @@ void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastTy
Vec3f velocity;
Vec3f accel;
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
+ for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
velocity.x = Rand_CenteredFloat(20.0f);
velocity.y = Rand_ZeroFloat(10.0f);
velocity.z = Rand_CenteredFloat(20.0f);
@@ -1097,7 +1099,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) {
Vec3f velocity;
Vec3f accel = { 0.0f, 0.0f, 0.0f };
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
+ for (i = 0; i < 150; i++) {
velocity.x = Rand_CenteredFloat(15.0f);
velocity.y = Rand_CenteredFloat(15.0f);
velocity.z = Rand_CenteredFloat(15.0f);
@@ -1151,7 +1153,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->targetPos.z, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].z, 1.0f, 400.0f);
if ((this->work[CS_TIMER_1] % 4) == 0) {
BossTw_AddRingEffect(globalCtx, &player->bodyPartsPos[PLAYER_BODYPART_R_HAND], 0.5f, 3.0f, 0xFF,
- this->actor.params, 1, 150);
+ this->actor.params, 1, BOSS_TW_EFFECT_COUNT);
}
} else {
this->beamShootState = 0;
@@ -1284,7 +1286,8 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) {
}
if (BossTw_BeamReflHitCheck(this, &this->actor.world.pos) && (this->work[CS_TIMER_1] % 4) == 0) {
- BossTw_AddRingEffect(globalCtx, &this->unk_530, 0.5f, 3.0f, 255, this->actor.params, 1, 150);
+ BossTw_AddRingEffect(globalCtx, &this->unk_530, 0.5f, 3.0f, 255, this->actor.params, 1,
+ BOSS_TW_EFFECT_COUNT);
}
if (BossTw_BeamReflHitCheck(this, &otherTw->actor.world.pos) && otherTw->actionFunc != BossTw_HitByBeam) {
@@ -4581,7 +4584,7 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) {
f32 phi_f0;
Actor* unk44;
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
+ for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
if (eff->type != 0) {
eff->pos.x += eff->curSpeed.x;
eff->pos.y += eff->curSpeed.y;
@@ -4897,7 +4900,7 @@ f32 BossTw_RandZeroOne(void) {
}
void BossTw_DrawEffects(GlobalContext* globalCtx) {
- u8 sp18F = 0;
+ u8 materialFlag = 0;
s16 i;
s16 j;
s32 pad;
@@ -4913,11 +4916,11 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) {
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
+ for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
if (currentEffect->type == 1) {
- if (sp18F == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, object_tw_DL_01A528);
- sp18F++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, currentEffect->color.r, currentEffect->color.g,
@@ -4933,14 +4936,14 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) {
currentEffect++;
}
- sp18F = 0;
+ materialFlag = 0;
currentEffect = effectHead;
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
+ for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
if (currentEffect->type == 3) {
- if (sp18F == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998));
- sp18F++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, currentEffect->alpha);
@@ -4957,15 +4960,15 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) {
currentEffect++;
}
- sp18F = 0;
+ materialFlag = 0;
currentEffect = effectHead;
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
+ for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
if (currentEffect->type == 2) {
- if (sp18F == 0) {
+ if (materialFlag == 0) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128);
- sp18F++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, currentEffect->alpha);
@@ -4983,13 +4986,13 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) {
currentEffect++;
}
- sp18F = 0;
+ materialFlag = 0;
currentEffect = effectHead;
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
+ for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
if (currentEffect->type == 4) {
- if (sp18F == 0) {
- sp18F++;
+ if (materialFlag == 0) {
+ materialFlag++;
}
gSPSegment(POLY_XLU_DISP++, 0xD,
@@ -5028,20 +5031,20 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) {
currentEffect++;
}
- sp18F = 0;
+ materialFlag = 0;
currentEffect = effectHead;
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
+ for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
Actor* actor;
Vec3f off;
if (currentEffect->type == TWEFF_PLYR_FRZ) {
- if (sp18F == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AA50));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, 255);
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, 0, 0x20, 0x20));
- sp18F++;
+ materialFlag++;
BossTw_InitRand(1, 0x71AC, 0x263A);
}
@@ -5074,10 +5077,10 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) {
currentEffect++;
}
- sp18F = 0;
+ materialFlag = 0;
currentEffect = effectHead;
- for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
+ for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
if (currentEffect->type >= 6) {
if (currentEffect->work[EFF_ARGS] == 0) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, currentEffect->alpha);
diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c
index af5d0526ad..357f9a0e48 100644
--- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c
+++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c
@@ -23,6 +23,8 @@
#define PHASE_4 15
#define PHASE_DEATH 18
+#define BOSS_VA_EFFECT_COUNT 400
+
typedef struct BossVaEffect {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f velocity;
@@ -376,7 +378,7 @@ static u8 sKillBari = 0;
static u8 sBodyBari[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static s16 sCsCamera = 0;
-static BossVaEffect sVaEffects[400];
+static BossVaEffect sEffects[BOSS_VA_EFFECT_COUNT];
static u8 sBodyState;
static u8 sFightPhase;
static s8 sCsState;
@@ -439,7 +441,7 @@ void BossVa_BloodDroplets(GlobalContext* globalCtx, Vec3f* pos, s16 phase, s16 y
spawnPos.x = Rand_CenteredFloat(10.0f) + pos->x;
spawnPos.y = pos->y - (Rand_ZeroOne() * 15.0f);
spawnPos.z = Rand_CenteredFloat(10.0f) + pos->z;
- BossVa_SpawnBloodDroplets(globalCtx, sVaEffects, &spawnPos, 65, phase, yaw);
+ BossVa_SpawnBloodDroplets(globalCtx, sEffects, &spawnPos, 65, phase, yaw);
}
}
@@ -451,7 +453,7 @@ void BossVa_BloodSplatter(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw,
pos.x = Rand_CenteredFloat(10.0f) + src->pos.x;
pos.y = src->pos.y - (Rand_ZeroOne() * 15.0f);
pos.z = Rand_CenteredFloat(10.0f) + src->pos.z;
- BossVa_SpawnBloodSplatter(globalCtx, sVaEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale);
+ BossVa_SpawnBloodSplatter(globalCtx, sEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale);
}
}
@@ -463,7 +465,7 @@ void BossVa_Gore(GlobalContext* globalCtx, BossVaEffect* src, s16 yaw, s16 scale
pos.x = Rand_CenteredFloat(10.0f) + src->pos.x;
pos.y = Rand_CenteredFloat(10.0f) + src->pos.y;
pos.z = Rand_CenteredFloat(10.0f) + src->pos.z;
- BossVa_SpawnGore(globalCtx, sVaEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale);
+ BossVa_SpawnGore(globalCtx, sEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale);
}
}
@@ -482,7 +484,7 @@ void BossVa_Spark(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale,
offset.x = Rand_CenteredFloat(xzSpread) + this->effectPos[index].x - this->actor.world.pos.x;
offset.y = Rand_CenteredFloat(ySpread) + this->effectPos[index].y - this->actor.world.pos.y;
offset.z = Rand_CenteredFloat(xzSpread) + this->effectPos[index].z - this->actor.world.pos.z;
- BossVa_SpawnSpark(globalCtx, sVaEffects, this, &offset, scale, mode);
+ BossVa_SpawnSpark(globalCtx, sEffects, this, &offset, scale, mode);
}
}
@@ -502,7 +504,7 @@ void BossVa_Tumor(GlobalContext* globalCtx, BossVa* this, s32 count, s16 scale,
offset.x = Rand_CenteredFloat(xzSpread) + this->effectPos[index].x - this->actor.world.pos.x;
offset.y = Rand_CenteredFloat(ySpread) + this->effectPos[index].y - this->actor.world.pos.y;
offset.z = Rand_CenteredFloat(xzSpread) + this->effectPos[index].z - this->actor.world.pos.z;
- BossVa_SpawnTumor(globalCtx, sVaEffects, this, &offset, scale, mode);
+ BossVa_SpawnTumor(globalCtx, sEffects, this, &offset, scale, mode);
}
}
@@ -687,7 +689,7 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) {
sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i);
}
- Lib_MemSet((u8*)sVaEffects, ARRAY_COUNT(sVaEffects) * sizeof(BossVaEffect), 0);
+ Lib_MemSet((u8*)sEffects, BOSS_VA_EFFECT_COUNT * sizeof(BossVaEffect), 0);
if (sCsState < BOSSVA_BATTLE) {
BossVa_SetupIntro(this);
} else {
@@ -1171,7 +1173,7 @@ void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) {
sp48.y += 310.0f + (this->actor.shape.yOffset * this->actor.scale.y);
sp48.x += -10.0f;
sp48.z += 220.0f;
- BossVa_SpawnSparkBall(globalCtx, sVaEffects, this, &sp48, 4, 0);
+ BossVa_SpawnSparkBall(globalCtx, sEffects, this, &sp48, 4, 0);
}
if (Rand_ZeroOne() < 0.1f) {
@@ -2096,7 +2098,7 @@ void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) {
if (this->timer2 == 20) {
Vec3f sp44 = this->zapHeadPos;
- BossVa_SpawnZapperCharge(globalCtx, sVaEffects, this, &sp44, &this->headRot, 100, 0);
+ BossVa_SpawnZapperCharge(globalCtx, sEffects, this, &sp44, &this->headRot, 100, 0);
}
}
@@ -2355,7 +2357,7 @@ void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) {
if (this->timer2 == 4) {
Vec3f sp48 = this->zapHeadPos;
- BossVa_SpawnZapperCharge(globalCtx, sVaEffects, this, &sp48, &this->headRot, 100, 0);
+ BossVa_SpawnZapperCharge(globalCtx, sEffects, this, &sp48, &this->headRot, 100, 0);
}
}
@@ -3280,7 +3282,7 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
if (*paramsPtr == BOSSVA_BODY) {
- BossVa_DrawEffects(sVaEffects, globalCtx);
+ BossVa_DrawEffects(sEffects, globalCtx);
} else if (*paramsPtr == BOSSVA_DOOR) {
BossVa_DrawDoor(globalCtx, sDoorState);
}
@@ -3291,7 +3293,7 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) {
static s32 sUnkValue = 0x009B0000; // Unreferenced? Possibly a color
void BossVa_UpdateEffects(GlobalContext* globalCtx) {
- BossVaEffect* effect = sVaEffects;
+ BossVaEffect* effect = sEffects;
Player* player = GET_PLAYER(globalCtx);
s16 spB6;
s16 i;
@@ -3309,7 +3311,7 @@ void BossVa_UpdateEffects(GlobalContext* globalCtx) {
f32 pad78;
f32 pad74;
- for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type != VA_NONE) {
effect->timer--;
@@ -3507,19 +3509,19 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) {
};
s16 i;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- u8 flag = 0;
+ u8 materialFlag = 0;
BossVaEffect* effectHead = effect;
Camera* camera = Gameplay_GetCamera(globalCtx, sCsCamera);
OPEN_DISPS(gfxCtx, "../z_boss_va.c", 4953);
- for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_LARGE_SPARK) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D84(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_XLU_DISP++, 130, 130, 30, 0);
gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_0156A0);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 230, effect->primColor[3]);
@@ -3534,12 +3536,12 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_SPARK_BALL) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D84(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_011738);
- flag++;
+ materialFlag++;
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
@@ -3560,13 +3562,13 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_BLOOD) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D84(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_009430);
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gEffBubble1Tex));
- flag++;
+ materialFlag++;
}
gDPPipeSync(POLY_XLU_DISP++);
@@ -3590,15 +3592,15 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_TUMOR) {
BossVa* parent = effect->parent;
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D18(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, effect->envColor[3]);
gSPDisplayList(POLY_OPA_DISP++, gBarinadeDL_0128B8);
- flag++;
+ materialFlag++;
}
if ((effect->mode != TUMOR_BODY) || ((Math_Vec3f_DistXZ(&camera->eye, &effect->pos) -
@@ -3614,12 +3616,12 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_GORE) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D18(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_OPA_DISP++, gBarinadeDL_012BA0);
- flag++;
+ materialFlag++;
}
gDPPipeSync(POLY_OPA_DISP++);
@@ -3645,12 +3647,12 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_ZAP_CHARGE) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D84(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_0135B0);
- flag++;
+ materialFlag++;
}
gDPPipeSync(POLY_XLU_DISP++);
@@ -3668,13 +3670,13 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_BLAST_SPARK) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093C14(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_XLU_DISP++, 130, 130, 30, 0);
gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_0156A0);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 230, effect->primColor[3]);
@@ -3690,13 +3692,13 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) {
}
effect = effectHead;
- for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0, materialFlag = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_SMALL_SPARK) {
- if (!flag) {
+ if (materialFlag == 0) {
func_80093D84(globalCtx->state.gfxCtx);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 100, 0);
gSPDisplayList(POLY_XLU_DISP++, gBarinadeDL_008F08);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->primColor[3]);
@@ -3722,7 +3724,7 @@ void BossVa_SpawnSpark(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* t
Vec3f tempVec;
s16 i;
- for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_LARGE_SPARK;
effect->parent = this;
@@ -3779,7 +3781,7 @@ void BossVa_SpawnSparkBall(GlobalContext* globalCtx, BossVaEffect* effect, BossV
Vec3f pos = { 0.0f, -1000.0f, 0.0f };
s16 i;
- for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_SPARK_BALL;
effect->parent = this;
@@ -3812,7 +3814,7 @@ void BossVa_SpawnBloodDroplets(GlobalContext* globalCtx, BossVaEffect* effect, V
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
f32 xzVel;
- for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_BLOOD;
effect->pos = *pos;
@@ -3842,7 +3844,7 @@ void BossVa_SpawnBloodSplatter(GlobalContext* globalCtx, BossVaEffect* effect, V
Vec3f accel = { 0.0f, 0.0f, 0.0f };
Vec3f velocity;
- for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_BLOOD;
effect->pos = *pos;
@@ -3876,7 +3878,7 @@ void BossVa_SpawnTumor(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* t
Vec3f pos = { 0.0f, -1000.0f, 0.0f };
s16 i;
- for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_TUMOR;
effect->parent = this;
@@ -3910,7 +3912,7 @@ void BossVa_SpawnGore(GlobalContext* globalCtx, BossVaEffect* effect, Vec3f* pos
Vec3f accel = { 0.0f, 0.0f, 0.0f };
Vec3f velocity;
- for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_GORE;
effect->pos = *pos;
@@ -3952,7 +3954,7 @@ void BossVa_SpawnZapperCharge(GlobalContext* globalCtx, BossVaEffect* effect, Bo
Vec3f unused = { 0.0f, -1000.0f, 0.0f };
s16 i;
- for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
+ for (i = 0; i < BOSS_VA_EFFECT_COUNT; i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_ZAP_CHARGE;
effect->parent = this;
diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c
index f4f27e1059..4015f2e2ad 100644
--- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c
+++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c
@@ -9,10 +9,10 @@ void EfcErupc_Update(Actor* thisx, GlobalContext* globalCtx);
void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx);
void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx);
-void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalCtx);
-void EfcErupc_UpdateParticles(EfcErupc* this, GlobalContext* globalCtx);
-void EfcErupc_AddParticle(EfcErupcParticles* particles, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scaleFactor);
-void EfcErupc_InitParticles(EfcErupcParticles* particles);
+void EfcErupc_DrawEffects(EfcErupcEffect* effect, GlobalContext* globalCtx);
+void EfcErupc_UpdateEffects(EfcErupc* this, GlobalContext* globalCtx);
+void EfcErupc_SpawnEffect(EfcErupcEffect* effect, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scaleFactor);
+void EfcErupc_InitEffects(EfcErupcEffect* effect);
const ActorInit Efc_Erupc_InitVars = {
ACTOR_EFC_ERUPC,
@@ -35,7 +35,7 @@ void EfcErupc_Init(Actor* thisx, GlobalContext* globalCtx) {
EfcErupc_SetupAction(this, EfcErupc_UpdateAction);
Actor_SetScale(&this->actor, 1.0f);
- EfcErupc_InitParticles(this->particles);
+ EfcErupc_InitEffects(this->effects);
this->unk_14C = this->unk_14E = this->unk_150 = 0;
this->unk_152 = 5;
this->unk_154 = -100;
@@ -99,7 +99,7 @@ void EfcErupc_UpdateAction(EfcErupc* this, GlobalContext* globalCtx) {
vel.y = Rand_ZeroFloat(100.0f);
vel.z = Rand_CenteredFloat(100.0f);
accel.y = this->unk_154 * 0.1f;
- EfcErupc_AddParticle(this->particles, &pos, &vel, &accel, 80.0f);
+ EfcErupc_SpawnEffect(this->effects, &pos, &vel, &accel, 80.0f);
}
}
@@ -107,7 +107,7 @@ void EfcErupc_Update(Actor* thisx, GlobalContext* globalCtx) {
EfcErupc* this = (EfcErupc*)thisx;
this->actionFunc(this, globalCtx);
- EfcErupc_UpdateParticles(this, globalCtx);
+ EfcErupc_UpdateEffects(this, globalCtx);
}
void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx) {
@@ -156,26 +156,25 @@ void EfcErupc_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_efc_erupc.c", 356);
- EfcErupc_DrawParticles(this->particles, globalCtx);
+ EfcErupc_DrawEffects(this->effects, globalCtx);
}
-void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalCtx) {
+void EfcErupc_DrawEffects(EfcErupcEffect* effect, GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s16 i;
s32 pad;
OPEN_DISPS(gfxCtx, "../z_efc_erupc.c", 368);
- for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) {
- if (particles->isActive) {
+ for (i = 0; i < EFC_ERUPC_EFFECT_COUNT; i++, effect++) {
+ if (effect->isActive) {
func_80093D84(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_002760);
- gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, particles->color.r, particles->color.g, particles->color.b,
- particles->alpha);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, effect->color.r, effect->color.g, effect->color.b, effect->alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 150, 0, 0, 0);
gDPPipeSync(POLY_XLU_DISP++);
- Matrix_Translate(particles->pos.x, particles->pos.y, particles->pos.z, MTXMODE_NEW);
+ Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
- Matrix_Scale(particles->scale, particles->scale, 1.0f, MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_efc_erupc.c", 393),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, object_efc_erupc_DL_0027D8);
@@ -191,19 +190,19 @@ static Color_RGB8 D_8099D770[] = {
{ 255, 0, 0 },
};
-void EfcErupc_UpdateParticles(EfcErupc* this, GlobalContext* globalCtx) {
+void EfcErupc_UpdateEffects(EfcErupc* this, GlobalContext* globalCtx) {
s16 i;
s16 index;
- Color_RGB8 particleColors[] = {
+ Color_RGB8 effectColors[] = {
{ 255, 128, 0 },
{ 255, 0, 0 },
{ 0, 0, 0 },
{ 100, 0, 0 },
};
Color_RGB8* color;
- EfcErupcParticles* cur = this->particles;
+ EfcErupcEffect* cur = this->effects;
- for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, cur++) {
+ for (i = 0; i < EFC_ERUPC_EFFECT_COUNT; i++, cur++) {
if (cur->isActive) {
cur->pos.x += cur->vel.x;
cur->pos.y += cur->vel.y;
@@ -213,7 +212,7 @@ void EfcErupc_UpdateParticles(EfcErupc* this, GlobalContext* globalCtx) {
cur->vel.z += cur->accel.z;
cur->animTimer += 1;
index = cur->animTimer % 4;
- color = &particleColors[index];
+ color = &effectColors[index];
cur->color.r = color->r;
cur->color.g = color->g;
cur->color.b = color->b;
@@ -226,27 +225,27 @@ void EfcErupc_UpdateParticles(EfcErupc* this, GlobalContext* globalCtx) {
}
}
-void EfcErupc_AddParticle(EfcErupcParticles* particles, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scaleFactor) {
+void EfcErupc_SpawnEffect(EfcErupcEffect* effect, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scaleFactor) {
s16 i;
- for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) {
- if (!particles->isActive) {
- particles->isActive = true;
- particles->pos = *pos;
- particles->vel = *vel;
- particles->accel = *accel;
- particles->scale = scaleFactor / 1000.0f;
- particles->alpha = 255;
- particles->animTimer = (s16)Rand_ZeroFloat(10.0f);
+ for (i = 0; i < EFC_ERUPC_EFFECT_COUNT; i++, effect++) {
+ if (!effect->isActive) {
+ effect->isActive = true;
+ effect->pos = *pos;
+ effect->vel = *vel;
+ effect->accel = *accel;
+ effect->scale = scaleFactor / 1000.0f;
+ effect->alpha = 255;
+ effect->animTimer = (s16)Rand_ZeroFloat(10.0f);
return;
}
}
}
-void EfcErupc_InitParticles(EfcErupcParticles* particles) {
+void EfcErupc_InitEffects(EfcErupcEffect* effect) {
s16 i;
- for (i = 0; i < EFC_ERUPC_NUM_PARTICLES; i++, particles++) {
- particles->isActive = false;
+ for (i = 0; i < EFC_ERUPC_EFFECT_COUNT; i++, effect++) {
+ effect->isActive = false;
}
}
diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h
index 3cc425daba..b96914931e 100644
--- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h
+++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.h
@@ -8,6 +8,8 @@ struct EfcErupc;
typedef void (*EfcErupcActionFunc)(struct EfcErupc*, GlobalContext*);
+#define EFC_ERUPC_EFFECT_COUNT 100
+
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f vel;
@@ -19,9 +21,7 @@ typedef struct {
/* 0x30 */ char unk_2C[4];
/* 0x34 */ f32 scale;
/* 0x38 */ char unk_34[8];
-} EfcErupcParticles; // size 0x3C
-
-#define EFC_ERUPC_NUM_PARTICLES 100
+} EfcErupcEffect; // size 0x3C
typedef struct EfcErupc {
/* 0x0000 */ Actor actor;
@@ -30,7 +30,7 @@ typedef struct EfcErupc {
/* 0x0150 */ s16 unk_150;
/* 0x0152 */ s16 unk_152;
/* 0x0154 */ s16 unk_154;
- /* 0x0158 */ EfcErupcParticles particles[EFC_ERUPC_NUM_PARTICLES];
+ /* 0x0158 */ EfcErupcEffect effects[EFC_ERUPC_EFFECT_COUNT];
/* 0x18C8 */ EfcErupcActionFunc actionFunc;
} EfcErupc; // size = 0x18CC
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 0e16041024..b70f35e22d 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
@@ -78,7 +78,7 @@ static ColliderCylinderInit sLaserCylinderInit = {
static UNK_TYPE4 D_809D5C98 = 0; // unused
static UNK_TYPE4 D_809D5C9C = 0; // unused
-static EnClearTagEffect sClearTagEffects[CLEAR_TAG_EFFECT_MAX_COUNT];
+static EnClearTagEffect sEffects[CLEAR_TAG_EFFECT_COUNT];
#include "overlays/ovl_En_Clear_Tag/ovl_En_Clear_Tag.c"
@@ -92,7 +92,7 @@ void EnClearTag_CreateDebrisEffect(GlobalContext* globalCtx, Vec3f* position, Ve
EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects;
// Look for an available effect to allocate a Debris effect to.
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_AVAILABLE) {
effect->type = CLEAR_TAG_EFFECT_DEBRIS;
@@ -126,7 +126,7 @@ void EnClearTag_CreateFireEffect(GlobalContext* globalCtx, Vec3f* pos, f32 scale
EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects;
// Look for an available effect to allocate a fire effect to.
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_AVAILABLE) {
effect->random = (s16)Rand_ZeroFloat(100.0f);
effect->type = CLEAR_TAG_EFFECT_FIRE;
@@ -154,7 +154,7 @@ void EnClearTag_CreateSmokeEffect(GlobalContext* globalCtx, Vec3f* position, f32
EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects;
// Look for an available effect to allocate a smoke effect to.
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_AVAILABLE) {
effect->random = (s16)Rand_ZeroFloat(100.0f);
effect->type = CLEAR_TAG_EFFECT_SMOKE;
@@ -190,7 +190,7 @@ void EnClearTag_CreateFlashEffect(GlobalContext* globalCtx, Vec3f* position, f32
EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects;
// Look for an available effect to allocate a flash effect to.
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_AVAILABLE) {
effect->type = CLEAR_TAG_EFFECT_FLASH;
@@ -271,9 +271,9 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) {
// Initialize all effects to available if effects have not been initialized.
if (!sIsEffectsInitialized) {
sIsEffectsInitialized = true;
- globalCtx->specialEffects = &sClearTagEffects[0];
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++) {
- sClearTagEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE;
+ globalCtx->specialEffects = sEffects;
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++) {
+ sEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE;
}
this->drawMode = CLEAR_TAG_DRAW_MODE_ALL;
}
@@ -780,7 +780,7 @@ void EnClearTag_UpdateEffects(GlobalContext* globalCtx) {
f32 originalYPosition;
Vec3f sphereCenter;
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type != CLEAR_TAG_EFFECT_AVAILABLE) {
effect->random++;
@@ -891,7 +891,7 @@ void EnClearTag_UpdateEffects(GlobalContext* globalCtx) {
void EnClearTag_DrawEffects(GlobalContext* globalCtx) {
s16 i;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- u8 isMaterialApplied = false;
+ u8 materialFlag = 0;
EnClearTagEffect* effect = (EnClearTagEffect*)globalCtx->specialEffects;
EnClearTagEffect* firstEffect = effect;
@@ -900,11 +900,11 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) {
func_80093D84(globalCtx->state.gfxCtx);
// Draw all Debris effects.
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_DEBRIS) {
// Apply the debris effect material if it has not already been applied.
- if (!isMaterialApplied) {
- isMaterialApplied++;
+ if (materialFlag == 0) {
+ materialFlag++;
gSPDisplayList(POLY_OPA_DISP++, gArwingDebrisEffectMaterialDL);
}
@@ -921,14 +921,14 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) {
// Draw all ground flash effects.
effect = firstEffect;
- isMaterialApplied = false;
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_FLASH) {
// Apply the flash ground effect material if it has not already been applied.
- if (!isMaterialApplied) {
+ if (materialFlag == 0) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 200, 0);
- isMaterialApplied++;
+ materialFlag++;
}
// Draw the ground flash effect.
@@ -945,13 +945,13 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) {
// Draw all smoke effects.
effect = firstEffect;
- isMaterialApplied = false;
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_SMOKE) {
// Apply the smoke effect material if it has not already been applied.
- if (!isMaterialApplied) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectMaterialDL);
- isMaterialApplied++;
+ materialFlag++;
}
// Draw the smoke effect.
@@ -974,14 +974,14 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) {
// Draw all fire effects.
effect = firstEffect;
- isMaterialApplied = false;
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_FIRE) {
// Apply the fire effect material if it has not already been applied.
- if (!isMaterialApplied) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, gArwingFireEffectMaterialDL);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128);
- isMaterialApplied++;
+ materialFlag++;
}
// Draw the fire effect.
@@ -1000,14 +1000,14 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) {
// Draw all flash billboard effects.
effect = firstEffect;
- isMaterialApplied = false;
- for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++, effect++) {
+ materialFlag = 0;
+ for (i = 0; i < CLEAR_TAG_EFFECT_COUNT; i++, effect++) {
if (effect->type == CLEAR_TAG_EFFECT_FLASH) {
// Apply the flash billboard effect material if it has not already been applied.
- if (!isMaterialApplied) {
+ if (materialFlag == 0) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 200, 0);
- isMaterialApplied++;
+ materialFlag++;
}
// Draw the flash billboard effect.
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 707fbb4a5d..96299ae2cf 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
@@ -72,6 +72,8 @@ typedef struct EnClearTag {
/* 0x01FE */ char unk_1FE[0x06];
} EnClearTag; // size = 0x0204
+#define CLEAR_TAG_EFFECT_COUNT 100
+
typedef struct EnClearTagEffect {
/* 0x0000 */ u8 type;
/* 0x0001 */ u8 random;
@@ -90,6 +92,4 @@ typedef struct EnClearTagEffect {
/* 0x0060 */ Vec3f floorTangent;
} EnClearTagEffect; // size = 0x6C
-#define CLEAR_TAG_EFFECT_MAX_COUNT 100
-
#endif
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 775fbae29d..273b68acea 100644
--- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
+++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
@@ -18,9 +18,9 @@ void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx);
void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx);
-void EnEncount2_ParticleInit(EnEncount2* this, Vec3f* particlePos, f32 scale);
-void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx);
-void EnEncount2_ParticleUpdate(EnEncount2* this, GlobalContext* globalCtx);
+void EnEncount2_SpawnEffect(EnEncount2* this, Vec3f* position, f32 scale);
+void EnEncount2_DrawEffects(Actor* thisx, GlobalContext* globalCtx);
+void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx);
const ActorInit En_Encount2_InitVars = {
ACTOR_EN_ENCOUNT2,
@@ -123,8 +123,8 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
f32 tempVec2X;
f32 tempVec2Y;
f32 tempVec2Z;
- f32 particleScale;
- Vec3f particlePos;
+ f32 effectScale;
+ Vec3f effectPos;
s16 spawnedRockType;
s16 spawnerState;
s16 maxRocks;
@@ -181,16 +181,16 @@ void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) {
// Position between 160 and 200 units ahead of camera depending on camera pitch, plus a 400 unit offset in +y
// (plus some random variation)
- particlePos.x = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.x + (tempVec2X * 200.0f));
- particlePos.y = Rand_CenteredFloat(50.0f) + tempVec1Y;
- particlePos.z = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.z + (tempVec2Z * 200.0f));
- particleScale = Rand_CenteredFloat(0.005f) + 0.007f;
+ effectPos.x = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.x + (tempVec2X * 200.0f));
+ effectPos.y = Rand_CenteredFloat(50.0f) + tempVec1Y;
+ effectPos.z = Rand_CenteredFloat(200.0f) + (globalCtx->view.eye.z + (tempVec2Z * 200.0f));
+ effectScale = Rand_CenteredFloat(0.005f) + 0.007f;
if (spawnerState == ENCOUNT2_ACTIVE_DEATH_MOUNTAIN) {
- EnEncount2_ParticleInit(this, &particlePos, particleScale);
- } else if (this->particleSpawnTimer == 0) {
- EnEncount2_ParticleInit(this, &particlePos, particleScale);
- this->particleSpawnTimer = 5;
+ EnEncount2_SpawnEffect(this, &effectPos, effectScale);
+ } else if (this->effectSpawnTimer == 0) {
+ EnEncount2_SpawnEffect(this, &effectPos, effectScale);
+ this->effectSpawnTimer = 5;
}
if ((this->numSpawnedRocks < maxRocks) && (this->timerBetweenRockSpawns == 0)) {
@@ -257,13 +257,13 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->timerBetweenRockSpawns--;
}
- if (this->particleSpawnTimer != 0) {
- this->particleSpawnTimer--;
+ if (this->effectSpawnTimer != 0) {
+ this->effectSpawnTimer--;
}
this->actionFunc(this, globalCtx);
- EnEncount2_ParticleUpdate(this, globalCtx);
+ EnEncount2_UpdateEffects(this, globalCtx);
if (!this->isNotDeathMountain) {
this->unk_17C = this->envEffectsTimer / 60.0f;
@@ -284,62 +284,62 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx2) {
void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnEncount2* this = (EnEncount2*)thisx;
- EnEncount2_ParticleDraw(&this->actor, globalCtx);
+ EnEncount2_DrawEffects(&this->actor, globalCtx);
}
-void EnEncount2_ParticleInit(EnEncount2* this, Vec3f* particlePos, f32 scale) {
- EnEncount2Particle* particle = this->particles;
+void EnEncount2_SpawnEffect(EnEncount2* this, Vec3f* position, f32 scale) {
+ EnEncount2Effect* effect = this->effects;
s16 i;
- for (i = 0; i < ARRAY_COUNT(this->particles); i++, particle++) {
- if (!particle->isAlive) {
- particle->pos = *particlePos;
- particle->scale = scale;
- particle->rot.x = 0.0f;
- particle->rot.y = 0.0f;
- particle->rot.z = 0.0f;
- particle->moveDirection.x = Rand_CenteredFloat(20.0f);
- particle->moveDirection.y = -20.0f;
- particle->moveDirection.z = Rand_CenteredFloat(20.0f);
- particle->isAlive = 1;
+ for (i = 0; i < EN_ENCOUNT2_EFFECT_COUNT; i++, effect++) {
+ if (!effect->isAlive) {
+ effect->pos = *position;
+ effect->scale = scale;
+ effect->rot.x = 0.0f;
+ effect->rot.y = 0.0f;
+ effect->rot.z = 0.0f;
+ effect->moveDirection.x = Rand_CenteredFloat(20.0f);
+ effect->moveDirection.y = -20.0f;
+ effect->moveDirection.z = Rand_CenteredFloat(20.0f);
+ effect->isAlive = 1;
break;
}
}
}
-void EnEncount2_ParticleUpdate(EnEncount2* this, GlobalContext* globalCtx) {
+void EnEncount2_UpdateEffects(EnEncount2* this, GlobalContext* globalCtx) {
s16 i;
- EnEncount2Particle* particle = this->particles;
+ EnEncount2Effect* effect = this->effects;
Player* player = GET_PLAYER(globalCtx);
Vec3f targetPos;
- for (i = 0; i < ARRAY_COUNT(this->particles); particle++, i++) {
- if (particle->isAlive) {
- particle->rot.x += Rand_ZeroOne() * 500.0f;
- particle->rot.y += Rand_ZeroOne() * 500.0f;
- particle->rot.z += Rand_ZeroOne() * 500.0f;
- targetPos.x = particle->pos.x + particle->moveDirection.x;
- targetPos.y = particle->pos.y + particle->moveDirection.y;
- targetPos.z = particle->pos.z + particle->moveDirection.z;
- Math_ApproachF(&particle->pos.x, targetPos.x, 0.3f, 30.0f);
- Math_ApproachF(&particle->pos.y, targetPos.y, 0.8f, 250.0f);
- Math_ApproachF(&particle->pos.z, targetPos.z, 0.3f, 30.0f);
- Math_ApproachF(&particle->moveDirection.y, -20.0f, 0.9f, 1.0f);
+ for (i = 0; i < EN_ENCOUNT2_EFFECT_COUNT; effect++, i++) {
+ if (effect->isAlive) {
+ effect->rot.x += Rand_ZeroOne() * 500.0f;
+ effect->rot.y += Rand_ZeroOne() * 500.0f;
+ effect->rot.z += Rand_ZeroOne() * 500.0f;
+ targetPos.x = effect->pos.x + effect->moveDirection.x;
+ targetPos.y = effect->pos.y + effect->moveDirection.y;
+ targetPos.z = effect->pos.z + effect->moveDirection.z;
+ Math_ApproachF(&effect->pos.x, targetPos.x, 0.3f, 30.0f);
+ Math_ApproachF(&effect->pos.y, targetPos.y, 0.8f, 250.0f);
+ Math_ApproachF(&effect->pos.z, targetPos.z, 0.3f, 30.0f);
+ Math_ApproachF(&effect->moveDirection.y, -20.0f, 0.9f, 1.0f);
if (globalCtx->sceneNum != SCENE_SPOT16) {
- if (particle->pos.y < (player->actor.floorHeight - 50.0f)) {
- particle->isAlive = 0;
+ if (effect->pos.y < (player->actor.floorHeight - 50.0f)) {
+ effect->isAlive = 0;
}
- } else if (particle->pos.y < 1500.0f) {
- particle->isAlive = 0;
+ } else if (effect->pos.y < 1500.0f) {
+ effect->isAlive = 0;
}
}
}
}
-void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx) {
+void EnEncount2_DrawEffects(Actor* thisx, GlobalContext* globalCtx) {
EnEncount2* this = (EnEncount2*)thisx;
- EnEncount2Particle* particle = this->particles;
+ EnEncount2Effect* effect = this->effects;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s16 i;
s32 objBankIndex;
@@ -352,13 +352,13 @@ void EnEncount2_ParticleDraw(Actor* thisx, GlobalContext* globalCtx) {
gDPPipeSync(POLY_XLU_DISP++);
gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment);
- for (i = 0; i < ARRAY_COUNT(this->particles); particle++, i++) {
- if (particle->isAlive) {
- Matrix_Translate(particle->pos.x, particle->pos.y, particle->pos.z, MTXMODE_NEW);
- Matrix_RotateX(DEG_TO_RAD(particle->rot.x), MTXMODE_APPLY);
- Matrix_RotateY(DEG_TO_RAD(particle->rot.y), MTXMODE_APPLY);
- Matrix_RotateZ(DEG_TO_RAD(particle->rot.z), MTXMODE_APPLY);
- Matrix_Scale(particle->scale, particle->scale, particle->scale, MTXMODE_APPLY);
+ for (i = 0; i < EN_ENCOUNT2_EFFECT_COUNT; effect++, i++) {
+ if (effect->isAlive) {
+ Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
+ Matrix_RotateX(DEG_TO_RAD(effect->rot.x), MTXMODE_APPLY);
+ Matrix_RotateY(DEG_TO_RAD(effect->rot.y), MTXMODE_APPLY);
+ Matrix_RotateZ(DEG_TO_RAD(effect->rot.z), MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 155, 55, 255);
gDPSetEnvColor(POLY_OPA_DISP++, 155, 255, 55, 255);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_encount2.c", 669),
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 433e5df74e..e998be8399 100644
--- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h
+++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.h
@@ -8,13 +8,15 @@ struct EnEncount2;
typedef void (*EnEncount2ActionFunc)(struct EnEncount2*, GlobalContext*);
+#define EN_ENCOUNT2_EFFECT_COUNT 50
+
typedef struct {
/* 0x0000 */ Vec3f pos;
/* 0x000C */ f32 scale;
/* 0x0010 */ u8 isAlive;
/* 0x0014 */ Vec3f moveDirection;
/* 0x0020 */ Vec3f rot;
-} EnEncount2Particle; // size = 0x2C
+} EnEncount2Effect; // size = 0x2C
typedef struct EnEncount2 {
/* 0x0000 */ Actor actor;
@@ -25,7 +27,7 @@ typedef struct EnEncount2 {
/* 0x0158 */ s16 numSpawnedRocks;
/* 0x015A */ s16 isNotDeathMountain;
/* 0x015C */ s16 collapseSpawnerInactive;
- /* 0x015E */ s16 particleSpawnTimer;
+ /* 0x015E */ s16 effectSpawnTimer;
/* 0x0160 */ f32 unk_160;
/* 0x0164 */ char unk164[0x4];
/* 0x0168 */ f32 unk_168;
@@ -35,7 +37,7 @@ typedef struct EnEncount2 {
/* 0x0178 */ s16 envEffectsTimer;
/* 0x017C */ f32 unk_17C;
/* 0x0180 */ u64 isQuaking;
- /* 0x0188 */ EnEncount2Particle particles[50];
+ /* 0x0188 */ EnEncount2Effect effects[EN_ENCOUNT2_EFFECT_COUNT];
} EnEncount2; // size = 0x0A20
#endif
diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c
index 481b628051..0999a6217c 100644
--- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c
+++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c
@@ -23,11 +23,11 @@ void EnFd_Reappear(EnFd* this, GlobalContext* globalCtx);
void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx);
void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx);
void EnFd_WaitForCore(EnFd* this, GlobalContext* globalCtx);
-void EnFd_UpdateFlames(EnFd* this);
-void EnFd_UpdateDots(EnFd* this);
-void EnFd_AddEffect(EnFd*, u8, Vec3f*, Vec3f*, Vec3f*, u8, f32, f32);
-void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx);
-void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx);
+void EnFd_UpdateEffectsFlames(EnFd* this);
+void EnFd_UpdateEffectsDots(EnFd* this);
+void EnFd_SpawnEffect(EnFd*, u8, Vec3f*, Vec3f*, Vec3f*, u8, f32, f32);
+void EnFd_DrawEffectsDots(EnFd* this, GlobalContext* globalCtx);
+void EnFd_DrawEffectsFlames(EnFd* this, GlobalContext* globalCtx);
void EnFd_Land(EnFd* this, GlobalContext* globalCtx);
const ActorInit En_Fd_InitVars = {
@@ -255,7 +255,7 @@ void EnFd_SpawnDot(EnFd* this, GlobalContext* globalCtx) {
accel.x = (Rand_ZeroOne() - 0.5f) * 2.0f;
accel.y = ((Rand_ZeroOne() - 0.5f) * 0.2f) + 0.3f;
accel.z = (Rand_ZeroOne() - 0.5f) * 2.0f;
- EnFd_AddEffect(this, FD_EFFECT_FLAME, &pos, &velocity, &accel, 8, 0.6f, 0.2f);
+ EnFd_SpawnEffect(this, FD_EFFECT_FLAME, &pos, &velocity, &accel, 8, 0.6f, 0.2f);
}
}
@@ -678,8 +678,8 @@ void EnFd_Update(Actor* thisx, GlobalContext* globalCtx) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
EnFd_Fade(this, globalCtx);
this->actionFunc(this, globalCtx);
- EnFd_UpdateDots(this);
- EnFd_UpdateFlames(this);
+ EnFd_UpdateEffectsDots(this);
+ EnFd_UpdateEffectsFlames(this);
if (this->actionFunc != EnFd_Reappear && this->actionFunc != EnFd_SpinAndGrow &&
this->actionFunc != EnFd_WaitForCore) {
if (this->attackTimer == 0 && this->invincibilityTimer == 0) {
@@ -739,7 +739,7 @@ void EnFd_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
accel.x = (Rand_ZeroOne() - 0.5f) * 0.4f;
accel.y = ((Rand_ZeroOne() - 0.5f) * 0.2f) + 0.6f;
accel.z = (Rand_ZeroOne() - 0.5f) * 0.4f;
- EnFd_AddEffect(this, FD_EFFECT_DOT, &pos, &velocity, &accel, 0, 0.006f, 0.0f);
+ EnFd_SpawnEffect(this, FD_EFFECT_DOT, &pos, &velocity, &accel, 0, 0.006f, 0.0f);
}
}
}
@@ -768,8 +768,8 @@ void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 1751);
Matrix_Push();
- EnFd_DrawDots(this, globalCtx);
- EnFd_DrawFlames(this, globalCtx);
+ EnFd_DrawEffectsDots(this, globalCtx);
+ EnFd_DrawEffectsFlames(this, globalCtx);
Matrix_Pop();
if (this->actionFunc != EnFd_Reappear && !(this->fadeAlpha < 0.9f)) {
if (1) {}
@@ -792,12 +792,12 @@ void EnFd_Draw(Actor* thisx, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 1822);
}
-void EnFd_AddEffect(EnFd* this, u8 type, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 timer, f32 scale,
- f32 scaleStep) {
+void EnFd_SpawnEffect(EnFd* this, u8 type, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 timer, f32 scale,
+ f32 scaleStep) {
EnFdEffect* eff = this->effects;
s16 i;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
+ for (i = 0; i < EN_FD_EFFECT_COUNT; i++, eff++) {
if (eff->type != FD_EFFECT_NONE) {
continue;
}
@@ -816,11 +816,11 @@ void EnFd_AddEffect(EnFd* this, u8 type, Vec3f* pos, Vec3f* velocity, Vec3f* acc
}
}
-void EnFd_UpdateFlames(EnFd* this) {
+void EnFd_UpdateEffectsFlames(EnFd* this) {
s16 i;
EnFdEffect* eff = this->effects;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
+ for (i = 0; i < EN_FD_EFFECT_COUNT; i++, eff++) {
if (eff->type == FD_EFFECT_FLAME) {
eff->timer--;
if (eff->timer == 0) {
@@ -839,7 +839,7 @@ void EnFd_UpdateFlames(EnFd* this) {
}
}
-void EnFd_UpdateDots(EnFd* this) {
+void EnFd_UpdateEffectsDots(EnFd* this) {
EnFdEffect* eff = this->effects;
s16 i;
Color_RGBA8 dotColors[] = {
@@ -849,7 +849,7 @@ void EnFd_UpdateDots(EnFd* this) {
{ 255, 0, 0, 0 },
};
- for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
+ for (i = 0; i < EN_FD_EFFECT_COUNT; i++, eff++) {
if (eff->type == FD_EFFECT_DOT) {
eff->pos.x += eff->velocity.x;
eff->pos.y += eff->velocity.y;
@@ -872,26 +872,26 @@ void EnFd_UpdateDots(EnFd* this) {
}
}
-void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) {
+void EnFd_DrawEffectsFlames(EnFd* this, GlobalContext* globalCtx) {
static void* dustTextures[] = {
gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex,
};
- s32 firstDone;
+ s32 materialFlag;
s16 i;
s16 idx;
EnFdEffect* eff = this->effects;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 1969);
- firstDone = false;
+ materialFlag = false;
if (1) {}
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
+ for (i = 0; i < EN_FD_EFFECT_COUNT; i++, eff++) {
if (eff->type == FD_EFFECT_FLAME) {
- if (!firstDone) {
+ if (!materialFlag) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_7928);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 10, 0, (u8)((this->fadeAlpha / 255.0f) * 255));
- firstDone = true;
+ materialFlag = true;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (u8)((this->fadeAlpha / 255.0f) * 255));
gDPPipeSync(POLY_XLU_DISP++);
@@ -908,22 +908,22 @@ void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 2020);
}
-void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) {
+void EnFd_DrawEffectsDots(EnFd* this, GlobalContext* globalCtx) {
s16 i;
- s16 firstDone;
+ s16 materialFlag;
EnFdEffect* eff = this->effects;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd.c", 2034);
- firstDone = false;
+ materialFlag = false;
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
+ for (i = 0; i < EN_FD_EFFECT_COUNT; i++, eff++) {
if (eff->type == FD_EFFECT_DOT) {
- if (!firstDone) {
+ if (!materialFlag) {
func_80093D84(globalCtx->state.gfxCtx);
gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_79F8);
- firstDone = true;
+ materialFlag = true;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, eff->color.r, eff->color.g, eff->color.b,
(u8)(eff->color.a * (this->fadeAlpha / 255.0f)));
diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.h b/src/overlays/actors/ovl_En_Fd/z_en_fd.h
index a00b622c92..cde714a400 100644
--- a/src/overlays/actors/ovl_En_Fd/z_en_fd.h
+++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.h
@@ -14,6 +14,8 @@ typedef enum {
FD_EFFECT_DOT
} FDEffectType;
+#define EN_FD_EFFECT_COUNT 200
+
typedef struct {
/* 0x0000 */ u8 type;
/* 0x0001 */ u8 timer;
@@ -47,7 +49,7 @@ typedef struct EnFd {
/* 0x04D0 */ Vec3f corePos;
/* 0x04DC */ Vec3s jointTable[27];
/* 0x057E */ Vec3s morphTable[27];
- /* 0x0620 */ EnFdEffect effects[200];
+ /* 0x0620 */ EnFdEffect effects[EN_FD_EFFECT_COUNT];
} EnFd; // size = 0x31E0
#endif
diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c
index 4ace60c661..711bc5cd79 100644
--- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c
+++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c
@@ -15,10 +15,10 @@ void EnFw_Init(Actor* thisx, GlobalContext* globalCtx);
void EnFw_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnFw_Update(Actor* thisx, GlobalContext* globalCtx);
void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx);
-void EnFw_UpdateDust(EnFw* this);
-void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx);
-void EnFw_AddDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* accel, u8 initialTimer, f32 scale,
- f32 scaleStep);
+void EnFw_UpdateEffects(EnFw* this);
+void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx);
+void EnFw_SpawnEffectDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* accel, u8 initialTimer, f32 scale,
+ f32 scaleStep);
void EnFw_Bounce(EnFw* this, GlobalContext* globalCtx);
void EnFw_Run(EnFw* this, GlobalContext* globalCtx);
void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx);
@@ -177,7 +177,7 @@ s32 EnFw_SpawnDust(EnFw* this, u8 timer, f32 scale, f32 scaleStep, s32 dustCnt,
accel.z = (Rand_ZeroOne() - 0.5f) * xzAccel;
pos.x = (Math_SinS(angle) * radius) + this->actor.world.pos.x;
pos.z = (Math_CosS(angle) * radius) + this->actor.world.pos.z;
- EnFw_AddDust(this, &pos, &velocity, &accel, timer, scale, scaleStep);
+ EnFw_SpawnEffectDust(this, &pos, &velocity, &accel, timer, scale, scaleStep);
angle += (s16)(0x10000 / dustCnt);
i--;
}
@@ -398,21 +398,21 @@ void EnFw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnFw* this = (EnFw*)thisx;
- EnFw_UpdateDust(this);
+ EnFw_UpdateEffects(this);
Matrix_Push();
- EnFw_DrawDust(this, globalCtx);
+ EnFw_DrawEffects(this, globalCtx);
Matrix_Pop();
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnFw_OverrideLimbDraw, EnFw_PostLimbDraw, this);
}
-void EnFw_AddDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* accel, u8 initialTimer, f32 scale,
- f32 scaleStep) {
+void EnFw_SpawnEffectDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* accel, u8 initialTimer, f32 scale,
+ f32 scaleStep) {
EnFwEffect* eff = this->effects;
s16 i;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
+ for (i = 0; i < EN_FW_EFFECT_COUNT; i++, eff++) {
if (eff->type != 1) {
eff->scale = scale;
eff->scaleStep = scaleStep;
@@ -426,11 +426,11 @@ void EnFw_AddDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* acc
}
}
-void EnFw_UpdateDust(EnFw* this) {
+void EnFw_UpdateEffects(EnFw* this) {
EnFwEffect* eff = this->effects;
s16 i;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
+ for (i = 0; i < EN_FW_EFFECT_COUNT; i++, eff++) {
if (eff->type != 0) {
if ((--eff->timer) == 0) {
eff->type = 0;
@@ -448,29 +448,29 @@ void EnFw_UpdateDust(EnFw* this) {
}
}
-void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) {
+void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx) {
static void* dustTextures[] = {
gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex,
};
EnFwEffect* eff = this->effects;
- s16 firstDone;
+ s16 materialFlag;
s16 alpha;
s16 i;
s16 idx;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fw.c", 1191);
- firstDone = false;
+ materialFlag = false;
func_80093D84(globalCtx->state.gfxCtx);
if (1) {}
- for (i = 0; i < ARRAY_COUNT(this->effects); i++, eff++) {
+ for (i = 0; i < EN_FW_EFFECT_COUNT; i++, eff++) {
if (eff->type != 0) {
- if (!firstDone) {
+ if (!materialFlag) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0U);
gSPDisplayList(POLY_XLU_DISP++, gFlareDancerDL_7928);
gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0);
- firstDone = true;
+ materialFlag = true;
}
alpha = eff->timer * (255.0f / eff->initialTimer);
diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.h b/src/overlays/actors/ovl_En_Fw/z_en_fw.h
index f7d245e5e4..c2d482b98f 100644
--- a/src/overlays/actors/ovl_En_Fw/z_en_fw.h
+++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.h
@@ -8,6 +8,8 @@ struct EnFw;
typedef void (*EnFwActionFunc)(struct EnFw* this, GlobalContext* globalCtx);
+#define EN_FW_EFFECT_COUNT 20
+
typedef struct {
/* 0x0000 */ u8 type;
/* 0x0001 */ u8 timer;
@@ -42,7 +44,7 @@ typedef struct EnFw {
/* 0x0218 */ f32 runRadius;
/* 0x021C */ Vec3s jointTable[11];
/* 0x025E */ Vec3s morphTable[11];
- /* 0x02A0 */ EnFwEffect effects[20];
+ /* 0x02A0 */ EnFwEffect effects[EN_FW_EFFECT_COUNT];
} EnFw; // size = 0x0700
#endif
diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c
index 35f323dd71..71f38da304 100644
--- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c
+++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c
@@ -43,7 +43,7 @@ void EnFz_SpawnIceSmokeNoFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f*
void EnFz_SpawnIceSmokeFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 xyScale, f32 xyScaleTarget,
s16 primAlpha, u8 isTimerMod8);
void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx);
-void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx);
+void EnFz_DrawEffects(EnFz* this, GlobalContext* globalCtx);
const ActorInit En_Fz_InitVars = {
ACTOR_EN_FZ,
@@ -741,152 +741,152 @@ void EnFz_Draw(Actor* thisx, GlobalContext* globalCtx) {
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fz.c", 1200);
- EnFz_DrawIceSmoke(this, globalCtx);
+ EnFz_DrawEffects(this, globalCtx);
}
void EnFz_SpawnIceSmokeNoFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 xyScale) {
- EnFzEffectSsIceSmoke* iceSmoke = this->iceSmoke;
+ EnFzEffect* effect = this->effects;
s16 i;
- for (i = 0; i < ARRAY_COUNT(this->iceSmoke); i++) {
- if (iceSmoke->type == 0) {
- iceSmoke->type = 1;
- iceSmoke->pos = *pos;
- iceSmoke->velocity = *velocity;
- iceSmoke->accel = *accel;
- iceSmoke->primAlphaState = 0;
- iceSmoke->xyScale = xyScale / 1000.0f;
- iceSmoke->primAlpha = 0;
- iceSmoke->timer = 0;
+ for (i = 0; i < EN_FZ_EFFECT_COUNT; i++) {
+ if (effect->type == 0) {
+ effect->type = 1;
+ effect->pos = *pos;
+ effect->velocity = *velocity;
+ effect->accel = *accel;
+ effect->primAlphaState = 0;
+ effect->xyScale = xyScale / 1000.0f;
+ effect->primAlpha = 0;
+ effect->timer = 0;
break;
}
- iceSmoke++;
+ effect++;
}
}
void EnFz_SpawnIceSmokeFreeze(EnFz* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 xyScale, f32 xyScaleTarget,
s16 primAlpha, u8 isTimerMod8) {
- EnFzEffectSsIceSmoke* iceSmoke = this->iceSmoke;
+ EnFzEffect* effect = this->effects;
s16 i;
- for (i = 0; i < ARRAY_COUNT(this->iceSmoke); i++) {
- if (iceSmoke->type == 0) {
- iceSmoke->type = 2;
- iceSmoke->pos = *pos;
- iceSmoke->velocity = *velocity;
- iceSmoke->accel = *accel;
- iceSmoke->primAlphaState = 0;
- iceSmoke->xyScale = xyScale / 1000.0f;
- iceSmoke->xyScaleTarget = xyScaleTarget / 1000.0f;
- iceSmoke->primAlpha = primAlpha;
- iceSmoke->timer = 0;
- iceSmoke->isTimerMod8 = isTimerMod8;
+ for (i = 0; i < EN_FZ_EFFECT_COUNT; i++) {
+ if (effect->type == 0) {
+ effect->type = 2;
+ effect->pos = *pos;
+ effect->velocity = *velocity;
+ effect->accel = *accel;
+ effect->primAlphaState = 0;
+ effect->xyScale = xyScale / 1000.0f;
+ effect->xyScaleTarget = xyScaleTarget / 1000.0f;
+ effect->primAlpha = primAlpha;
+ effect->timer = 0;
+ effect->isTimerMod8 = isTimerMod8;
break;
}
- iceSmoke++;
+ effect++;
}
}
void EnFz_UpdateIceSmoke(EnFz* this, GlobalContext* globalCtx) {
- EnFzEffectSsIceSmoke* iceSmoke = this->iceSmoke;
+ EnFzEffect* effect = this->effects;
s16 i;
Vec3f pos;
- for (i = 0; i < ARRAY_COUNT(this->iceSmoke); i++) {
- if (iceSmoke->type) {
- iceSmoke->pos.x += iceSmoke->velocity.x;
- iceSmoke->pos.y += iceSmoke->velocity.y;
- iceSmoke->pos.z += iceSmoke->velocity.z;
- iceSmoke->timer++;
- iceSmoke->velocity.x += iceSmoke->accel.x;
- iceSmoke->velocity.y += iceSmoke->accel.y;
- iceSmoke->velocity.z += iceSmoke->accel.z;
- if (iceSmoke->type == 1) {
- if (iceSmoke->primAlphaState == 0) { // Becoming more opaque
- iceSmoke->primAlpha += 10;
- if (iceSmoke->primAlpha >= 100) {
- iceSmoke->primAlphaState++;
+ for (i = 0; i < EN_FZ_EFFECT_COUNT; i++) {
+ if (effect->type) {
+ effect->pos.x += effect->velocity.x;
+ effect->pos.y += effect->velocity.y;
+ effect->pos.z += effect->velocity.z;
+ effect->timer++;
+ effect->velocity.x += effect->accel.x;
+ effect->velocity.y += effect->accel.y;
+ effect->velocity.z += effect->accel.z;
+ if (effect->type == 1) {
+ if (effect->primAlphaState == 0) { // Becoming more opaque
+ effect->primAlpha += 10;
+ if (effect->primAlpha >= 100) {
+ effect->primAlphaState++;
}
} else { // Becoming more transparent
- iceSmoke->primAlpha -= 3;
- if (iceSmoke->primAlpha <= 0) {
- iceSmoke->primAlpha = 0;
- iceSmoke->type = 0;
+ effect->primAlpha -= 3;
+ if (effect->primAlpha <= 0) {
+ effect->primAlpha = 0;
+ effect->type = 0;
}
}
- } else if (iceSmoke->type == 2) { // Freezing
- Math_ApproachF(&iceSmoke->xyScale, iceSmoke->xyScaleTarget, 0.1f, iceSmoke->xyScaleTarget / 10.0f);
- if (iceSmoke->primAlphaState == 0) { // Becoming more opaque
- if (iceSmoke->timer >= 7) {
- iceSmoke->primAlphaState++;
+ } else if (effect->type == 2) { // Freezing
+ Math_ApproachF(&effect->xyScale, effect->xyScaleTarget, 0.1f, effect->xyScaleTarget / 10.0f);
+ if (effect->primAlphaState == 0) { // Becoming more opaque
+ if (effect->timer >= 7) {
+ effect->primAlphaState++;
}
} else { // Becoming more transparent, slows down
- iceSmoke->accel.y = 2.0f;
- iceSmoke->primAlpha -= 17;
- iceSmoke->velocity.x *= 0.75f;
- iceSmoke->velocity.z *= 0.75f;
- if (iceSmoke->primAlpha <= 0) {
- iceSmoke->primAlpha = 0;
- iceSmoke->type = 0;
+ effect->accel.y = 2.0f;
+ effect->primAlpha -= 17;
+ effect->velocity.x *= 0.75f;
+ effect->velocity.z *= 0.75f;
+ if (effect->primAlpha <= 0) {
+ effect->primAlpha = 0;
+ effect->type = 0;
}
}
- if ((this->unusedTimer2 == 0) && (iceSmoke->primAlpha >= 101) && iceSmoke->isTimerMod8) {
- this->collider3.dim.pos.x = (s16)iceSmoke->pos.x;
- this->collider3.dim.pos.y = (s16)iceSmoke->pos.y;
- this->collider3.dim.pos.z = (s16)iceSmoke->pos.z;
+ if ((this->unusedTimer2 == 0) && (effect->primAlpha >= 101) && effect->isTimerMod8) {
+ this->collider3.dim.pos.x = (s16)effect->pos.x;
+ this->collider3.dim.pos.y = (s16)effect->pos.y;
+ this->collider3.dim.pos.z = (s16)effect->pos.z;
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider3.base);
}
- pos.x = iceSmoke->pos.x;
- pos.y = iceSmoke->pos.y + 10.0f;
- pos.z = iceSmoke->pos.z;
+ pos.x = effect->pos.x;
+ pos.y = effect->pos.y + 10.0f;
+ pos.z = effect->pos.z;
- if ((iceSmoke->primAlphaState != 2) && EnFz_ReachedTarget(this, &pos)) {
- iceSmoke->primAlphaState = 2;
- iceSmoke->velocity.x = 0.0f;
- iceSmoke->velocity.z = 0.0f;
+ if ((effect->primAlphaState != 2) && EnFz_ReachedTarget(this, &pos)) {
+ effect->primAlphaState = 2;
+ effect->velocity.x = 0.0f;
+ effect->velocity.z = 0.0f;
}
}
}
- iceSmoke++;
+ effect++;
}
}
-void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx) {
- EnFzEffectSsIceSmoke* iceSmoke = this->iceSmoke;
+void EnFz_DrawEffects(EnFz* this, GlobalContext* globalCtx) {
+ EnFzEffect* effect = this->effects;
s16 i;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- u8 texLoaded = false;
+ u8 materialFlag = 0;
OPEN_DISPS(gfxCtx, "../z_en_fz.c", 1384);
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < ARRAY_COUNT(this->iceSmoke); i++) {
- if (iceSmoke->type > 0) {
+ for (i = 0; i < EN_FZ_EFFECT_COUNT; i++) {
+ if (effect->type > 0) {
gDPPipeSync(POLY_XLU_DISP++);
- if (!texLoaded) {
+ if (!materialFlag) {
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamStartDL));
- texLoaded++;
+ materialFlag++;
}
- gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, iceSmoke->primAlpha);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, effect->primAlpha);
gSPSegment(POLY_XLU_DISP++, 0x08,
- Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 3 * (iceSmoke->timer + (3 * i)),
- 15 * (iceSmoke->timer + (3 * i)), 32, 64, 1, 0, 0, 32, 32));
- Matrix_Translate(iceSmoke->pos.x, iceSmoke->pos.y, iceSmoke->pos.z, MTXMODE_NEW);
+ Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 3 * (effect->timer + (3 * i)),
+ 15 * (effect->timer + (3 * i)), 32, 64, 1, 0, 0, 32, 32));
+ Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
- Matrix_Scale(iceSmoke->xyScale, iceSmoke->xyScale, 1.0f, MTXMODE_APPLY);
+ Matrix_Scale(effect->xyScale, effect->xyScale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_fz.c", 1424),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gFreezardSteamDL));
}
- iceSmoke++;
+ effect++;
}
CLOSE_DISPS(gfxCtx, "../z_en_fz.c", 1430);
diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.h b/src/overlays/actors/ovl_En_Fz/z_en_fz.h
index 03fb037175..eac5e972e1 100644
--- a/src/overlays/actors/ovl_En_Fz/z_en_fz.h
+++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.h
@@ -21,7 +21,9 @@ typedef struct {
/* 0x0030 */ f32 xyScale;
/* 0x0034 */ f32 xyScaleTarget;
/* 0x0038 */ u8 isTimerMod8; // conditional, used to run CollisionCheck_SetAT
-} EnFzEffectSsIceSmoke; // size = 0x3C
+} EnFzEffect; // size = 0x3C
+
+#define EN_FZ_EFFECT_COUNT 40
typedef struct EnFz {
/* 0x0000 */ Actor actor;
@@ -49,7 +51,7 @@ typedef struct EnFz {
/* 0x0263 */ u8 unusedTimer2; // Timer
/* 0x0264 */ Vec3f wallHitPos; // Position contact was made with a wall
/* 0x0270 */ f32 distToTargetSq;
- /* 0x0274 */ EnFzEffectSsIceSmoke iceSmoke[40];
+ /* 0x0274 */ EnFzEffect effects[EN_FZ_EFFECT_COUNT];
} EnFz; // size = 0x0BD4
#endif
diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c
index c72cc0093e..c571de0688 100644
--- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c
+++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c
@@ -82,7 +82,7 @@ void EnGSwitch_Init(Actor* thisx, GlobalContext* globalCtx) {
this->type = (this->actor.params >> 0xC) & 0xF;
this->switchFlag = this->actor.params & 0x3F;
- this->numEffects = ARRAY_COUNT(this->effects);
+ this->numEffects = EN_GSWITCH_EFFECT_COUNT;
// "index"
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ インデックス ☆☆☆☆☆ %x\n" VT_RST, this->type);
// "save"
diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h
index 0bc7cce994..dd4f885a34 100644
--- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h
+++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.h
@@ -24,6 +24,8 @@ typedef enum {
/* 3 */ ENGSWITCH_TARGET_RUPEE
} EnGSwitchType;
+#define EN_GSWITCH_EFFECT_COUNT 100
+
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ s16 scale;
@@ -54,7 +56,7 @@ typedef struct EnGSwitch {
/* 0x016C */ Vec3f targetPos;
/* 0x0178 */ s8 objIndex;
/* 0x017C */ ColliderCylinder collider;
- /* 0x01C8 */ EnGSwitchEffect effects[100];
+ /* 0x01C8 */ EnGSwitchEffect effects[EN_GSWITCH_EFFECT_COUNT];
} EnGSwitch; // size = 0x12F8
#endif
diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c
index 52774535e5..5a28d1092e 100644
--- a/src/overlays/actors/ovl_En_Go/z_en_go.c
+++ b/src/overlays/actors/ovl_En_Go/z_en_go.c
@@ -29,9 +29,10 @@ void func_80A40C78(EnGo* this, GlobalContext* globalCtx);
void EnGo_Eyedrops(EnGo* this, GlobalContext* globalCtx);
void func_80A40DCC(EnGo* this, GlobalContext* globalCtx);
-void EnGo_AddDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep);
-void EnGo_UpdateDust(EnGo* this);
-void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx);
+void EnGo_SpawnEffectDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale,
+ f32 scaleStep);
+void EnGo_UpdateEffects(EnGo* this);
+void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx);
const ActorInit En_Go_InitVars = {
ACTOR_EN_GO,
@@ -532,7 +533,7 @@ s32 EnGo_SpawnDust(EnGo* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 nu
accel.z = (Rand_ZeroOne() - 0.5f) * xzAccel;
pos.x = (Math_SinS(angle) * radius) + this->actor.world.pos.x;
pos.z = (Math_CosS(angle) * radius) + this->actor.world.pos.z;
- EnGo_AddDust(this, &pos, &velocity, &accel, initialTimer, scale, scaleStep);
+ EnGo_SpawnEffectDust(this, &pos, &velocity, &accel, initialTimer, scale, scaleStep);
angle += (s16)(0x10000 / numDustEffects);
i--;
}
@@ -1124,9 +1125,9 @@ void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2479);
- EnGo_UpdateDust(this);
+ EnGo_UpdateEffects(this);
Matrix_Push();
- EnGo_DrawDust(this, globalCtx);
+ EnGo_DrawEffects(this, globalCtx);
Matrix_Pop();
if (this->actionFunc == EnGo_CurledUp) {
@@ -1145,16 +1146,17 @@ void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx) {
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2525);
- EnGo_DrawDust(this, globalCtx);
+ EnGo_DrawEffects(this, globalCtx);
}
}
-void EnGo_AddDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep) {
- EnGoEffect* dustEffect = this->dustEffects;
+void EnGo_SpawnEffectDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale,
+ f32 scaleStep) {
+ EnGoEffect* dustEffect = this->effects;
s16 i;
s16 timer;
- for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) {
+ for (i = 0; i < EN_GO_EFFECT_COUNT; i++, dustEffect++) {
if (dustEffect->type != 1) {
dustEffect->scale = scale;
dustEffect->scaleStep = scaleStep;
@@ -1171,12 +1173,12 @@ void EnGo_AddDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 init
}
}
-void EnGo_UpdateDust(EnGo* this) {
- EnGoEffect* dustEffect = this->dustEffects;
+void EnGo_UpdateEffects(EnGo* this) {
+ EnGoEffect* dustEffect = this->effects;
f32 randomNumber;
s16 i;
- for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) {
+ for (i = 0; i < EN_GO_EFFECT_COUNT; i++, dustEffect++) {
if (dustEffect->type) {
dustEffect->timer--;
if (dustEffect->timer == 0) {
@@ -1197,25 +1199,25 @@ void EnGo_UpdateDust(EnGo* this) {
}
}
-void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) {
+void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx) {
static void* dustTex[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex };
- EnGoEffect* dustEffect = this->dustEffects;
+ EnGoEffect* dustEffect = this->effects;
s16 alpha;
- s16 firstDone;
+ s16 materialFlag;
s16 index;
s16 i;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2626);
- firstDone = false;
+ materialFlag = false;
func_80093D84(globalCtx->state.gfxCtx);
if (1) {}
- for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) {
+ for (i = 0; i < EN_GO_EFFECT_COUNT; i++, dustEffect++) {
if (dustEffect->type) {
- if (!firstDone) {
+ if (!materialFlag) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40);
gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0);
- firstDone = true;
+ materialFlag = true;
}
alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer);
diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.h b/src/overlays/actors/ovl_En_Go/z_en_go.h
index f020e8de1d..551299e550 100644
--- a/src/overlays/actors/ovl_En_Go/z_en_go.h
+++ b/src/overlays/actors/ovl_En_Go/z_en_go.h
@@ -23,6 +23,8 @@ typedef s16 (*callback2_80A3ED24)(GlobalContext*, struct EnGo*);
// /* 0x90 */ GORON1_DMT_BIGGORON,
+#define EN_GO_EFFECT_COUNT 20
+
typedef struct {
/* 0x0000 */ u8 type;
/* 0x0001 */ u8 timer;
@@ -55,7 +57,7 @@ typedef struct EnGo {
/* 0x021E */ s16 unk_21E;
/* 0x0220 */ s16 jointTable[18];
/* 0x0244 */ s16 morphTable[18];
- /* 0x0268 */ EnGoEffect dustEffects[20];
+ /* 0x0268 */ EnGoEffect effects[EN_GO_EFFECT_COUNT];
} EnGo; // size = 0x06C8
#endif
diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c
index b2be801fdb..74e2356e52 100644
--- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c
+++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c
@@ -168,12 +168,13 @@ static EnGo2DustEffectData sDustEffectData[2][4] = {
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
-void EnGo2_AddDust(EnGo2* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale, f32 scaleStep) {
- EnGoEffect* dustEffect = this->dustEffects;
+void EnGo2_SpawnEffectDust(EnGo2* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale,
+ f32 scaleStep) {
+ EnGoEffect* dustEffect = this->effects;
s16 i;
s16 timer;
- for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) {
+ for (i = 0; i < EN_GO2_EFFECT_COUNT; i++, dustEffect++) {
if (dustEffect->type != 1) {
dustEffect->scale = scale;
dustEffect->scaleStep = scaleStep;
@@ -190,12 +191,12 @@ void EnGo2_AddDust(EnGo2* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 in
}
}
-void EnGo2_UpdateDust(EnGo2* this) {
- EnGoEffect* dustEffect = this->dustEffects;
+void EnGo2_UpdateEffects(EnGo2* this) {
+ EnGoEffect* dustEffect = this->effects;
f32 randomNumber;
s16 i;
- for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) {
+ for (i = 0; i < EN_GO2_EFFECT_COUNT; i++, dustEffect++) {
if (dustEffect->type) {
dustEffect->timer--;
if (dustEffect->timer == 0) {
@@ -215,26 +216,26 @@ void EnGo2_UpdateDust(EnGo2* this) {
}
}
-void EnGo2_DrawDust(EnGo2* this, GlobalContext* globalCtx) {
- EnGoEffect* dustEffect = this->dustEffects;
+void EnGo2_DrawEffects(EnGo2* this, GlobalContext* globalCtx) {
+ EnGoEffect* dustEffect = this->effects;
s16 alpha;
- s16 firstDone;
+ s16 materialFlag;
s16 index;
s16 i;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go2_eff.c", 111);
- firstDone = false;
+ materialFlag = false;
func_80093D84(globalCtx->state.gfxCtx);
if (1) {}
- for (i = 0; i < ARRAY_COUNT(this->dustEffects); i++, dustEffect++) {
+ for (i = 0; i < EN_GO2_EFFECT_COUNT; i++, dustEffect++) {
if (dustEffect->type) {
- if (!firstDone) {
+ if (!materialFlag) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40);
gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0);
- firstDone = true;
+ materialFlag = true;
}
alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer);
@@ -270,7 +271,7 @@ s32 EnGo2_SpawnDust(EnGo2* this, u8 initialTimer, f32 scale, f32 scaleStep, s32
accel.y += Rand_ZeroOne() * yAccel;
pos.x = (Math_SinS(angle) * radius) + this->actor.world.pos.x;
pos.z = (Math_CosS(angle) * radius) + this->actor.world.pos.z;
- EnGo2_AddDust(this, &pos, &velocity, &accel, initialTimer, scale, scaleStep);
+ EnGo2_SpawnEffectDust(this, &pos, &velocity, &accel, initialTimer, scale, scaleStep);
angle += (s16)(0x10000 / numDustEffects);
i--;
}
@@ -2040,9 +2041,9 @@ void EnGo2_Draw(Actor* thisx, GlobalContext* globalCtx) {
void* eyeTextures[] = { gGoronCsEyeClosed2Tex, gGoronCsEyeOpenTex, gGoronCsEyeHalfTex, gGoronCsEyeClosedTex };
void* mouthTextures[] = { gGoronCsMouthNeutralTex, gGoronCsMouthSmileTex };
- EnGo2_UpdateDust(this);
+ EnGo2_UpdateEffects(this);
Matrix_Push();
- EnGo2_DrawDust(this, globalCtx);
+ EnGo2_DrawEffects(this, globalCtx);
Matrix_Pop();
if ((this->actionFunc == EnGo2_CurledUp) && (this->skelAnime.playSpeed == 0.0f) &&
diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h
index 079938097b..9c8c1076a2 100644
--- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h
+++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h
@@ -65,6 +65,8 @@ typedef struct {
f32 yAccel;
} EnGo2DustEffectData; // size = 0x18
+#define EN_GO2_EFFECT_COUNT 10
+
typedef struct EnGo2 {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
@@ -93,7 +95,7 @@ typedef struct EnGo2 {
/* 0x0226 */ s16 unk_226[18]; // Remains unknown
/* 0x024A */ s16 unk_24A[18]; // Remains unknown
/* 0x026E */ u16 unk_26E; // Remains unknown = 1, 2, or 4: used in func_80034A14
- /* 0x0270 */ EnGoEffect dustEffects[10];
+ /* 0x0270 */ EnGoEffect effects[EN_GO2_EFFECT_COUNT];
/* 0x04A0 */ Vec3f eye;
/* 0x04AC */ Vec3f at;
/* 0x04B8 */ Vec3s jointTable[18];
diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c
index 1c93460c9e..c9431db52b 100644
--- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c
+++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c
@@ -30,9 +30,9 @@ void func_80AB714C(EnNiw* this, GlobalContext* globalCtx);
void func_80AB7204(EnNiw* this, GlobalContext* globalCtx);
void func_80AB7290(EnNiw* this, GlobalContext* globalCtx);
void func_80AB7328(EnNiw* this, GlobalContext* globalCtx);
-void EnNiw_FeatherSpawn(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale);
-void EnNiw_FeatherUpdate(EnNiw* this, GlobalContext* globalCtx);
-void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx);
+void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale);
+void EnNiw_UpdateEffects(EnNiw* this, GlobalContext* globalCtx);
+void EnNiw_DrawEffects(EnNiw* this, GlobalContext* globalCtx);
static s16 D_80AB85E0 = 0;
@@ -922,13 +922,13 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
accel.x = 0.0f;
accel.y = -0.15f;
accel.z = 0.0f;
- EnNiw_FeatherSpawn(this, &pos, &vel, &accel, scale);
+ EnNiw_SpawnFeather(this, &pos, &vel, &accel, scale);
}
this->unk_2A6 = 0;
}
- EnNiw_FeatherUpdate(this, globalCtx);
+ EnNiw_UpdateEffects(this, globalCtx);
if (this->timer1 != 0) {
this->timer1--;
}
@@ -1145,84 +1145,84 @@ void EnNiw_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_80033C30(&this->actor.world.pos, &scale, 255, globalCtx);
}
- EnNiw_FeatherDraw(this, globalCtx);
+ EnNiw_DrawEffects(this, globalCtx);
}
-void EnNiw_FeatherSpawn(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale) {
+void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale) {
s16 i;
- EnNiwFeather* feather = this->feathers;
+ EnNiwEffect* effect = this->effects;
- for (i = 0; i < ARRAY_COUNT(this->feathers); i++, feather++) {
- if (feather->type == 0) {
- feather->type = 1;
- feather->pos = *pos;
- feather->vel = *vel;
- feather->accel = *accel;
- feather->timer = 0;
- feather->scale = scale / 1000.0f;
- feather->life = (s16)Rand_ZeroFloat(20.0f) + 40;
- feather->unk_2A = Rand_ZeroFloat(1000.0f);
+ for (i = 0; i < EN_NIW_EFFECT_COUNT; i++, effect++) {
+ if (effect->type == 0) {
+ effect->type = 1;
+ effect->pos = *pos;
+ effect->vel = *vel;
+ effect->accel = *accel;
+ effect->timer = 0;
+ effect->scale = scale / 1000.0f;
+ effect->life = (s16)Rand_ZeroFloat(20.0f) + 40;
+ effect->unk_2A = Rand_ZeroFloat(1000.0f);
break;
}
}
}
-void EnNiw_FeatherUpdate(EnNiw* this, GlobalContext* globalCtx) {
+void EnNiw_UpdateEffects(EnNiw* this, GlobalContext* globalCtx) {
s16 i;
- EnNiwFeather* feather = this->feathers;
+ EnNiwEffect* effect = this->effects;
- for (i = 0; i < ARRAY_COUNT(this->feathers); i++, feather++) {
- if (feather->type != 0) {
- feather->timer++;
- feather->pos.x += feather->vel.x;
- feather->pos.y += feather->vel.y;
- feather->pos.z += feather->vel.z;
- feather->vel.x += feather->accel.x;
- feather->vel.y += feather->accel.y;
- feather->vel.z += feather->accel.z;
- if (feather->type == 1) {
- feather->unk_2A++;
- Math_ApproachF(&feather->vel.x, 0.0f, 1.0f, 0.05f);
- Math_ApproachF(&feather->vel.z, 0.0f, 1.0f, 0.05f);
- if (feather->vel.y < -0.5f) {
- feather->vel.y = -0.5f;
+ for (i = 0; i < EN_NIW_EFFECT_COUNT; i++, effect++) {
+ if (effect->type != 0) {
+ effect->timer++;
+ effect->pos.x += effect->vel.x;
+ effect->pos.y += effect->vel.y;
+ effect->pos.z += effect->vel.z;
+ effect->vel.x += effect->accel.x;
+ effect->vel.y += effect->accel.y;
+ effect->vel.z += effect->accel.z;
+ if (effect->type == 1) {
+ effect->unk_2A++;
+ Math_ApproachF(&effect->vel.x, 0.0f, 1.0f, 0.05f);
+ Math_ApproachF(&effect->vel.z, 0.0f, 1.0f, 0.05f);
+ if (effect->vel.y < -0.5f) {
+ effect->vel.y = -0.5f;
}
- feather->unk_30 = Math_SinS(feather->unk_2A * 0xBB8) * M_PI * 0.2f;
+ effect->unk_30 = Math_SinS(effect->unk_2A * 0xBB8) * M_PI * 0.2f;
- if (feather->life < feather->timer) {
- feather->type = 0;
+ if (effect->life < effect->timer) {
+ effect->type = 0;
}
}
}
}
}
-void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx) {
- u8 flag = 0;
+void EnNiw_DrawEffects(EnNiw* this, GlobalContext* globalCtx) {
+ u8 materialFlag = 0;
s16 i;
s32 pad;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
- EnNiwFeather* feather = &this->feathers[0];
+ EnNiwEffect* effect = &this->effects[0];
OPEN_DISPS(gfxCtx, "../z_en_niw.c", 1897);
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < ARRAY_COUNT(this->feathers); i++, feather++) {
- if (feather->type == 1) {
- if (!flag) {
- gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAppearDL);
- flag++;
+ for (i = 0; i < EN_NIW_EFFECT_COUNT; i++, effect++) {
+ if (effect->type == 1) {
+ if (materialFlag == 0) {
+ gSPDisplayList(POLY_XLU_DISP++, gCuccoEffectFeatherMaterialDL);
+ materialFlag++;
}
- Matrix_Translate(feather->pos.x, feather->pos.y, feather->pos.z, MTXMODE_NEW);
+ Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
- Matrix_Scale(feather->scale, feather->scale, 1.0f, MTXMODE_APPLY);
- Matrix_RotateZ(feather->unk_30, MTXMODE_APPLY);
+ Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY);
+ Matrix_RotateZ(effect->unk_30, MTXMODE_APPLY);
Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_niw.c", 1913),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAliveDL);
+ gSPDisplayList(POLY_XLU_DISP++, gCuccoEffectFeatherModelDL);
}
}
diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h
index d027324968..87707c0c06 100644
--- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h
+++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h
@@ -18,7 +18,9 @@ typedef struct {
/* 0x002C */ f32 scale;
/* 0x0030 */ f32 unk_30;
/* 0x0034 */ u8 timer;
-} EnNiwFeather; // size = 0x0038
+} EnNiwEffect; // size = 0x0038
+
+#define EN_NIW_EFFECT_COUNT 20
typedef struct EnNiw {
/* 0x0000 */ Actor actor;
@@ -73,7 +75,7 @@ typedef struct EnNiw {
/* 0x0304 */ f32 unk_304;
/* 0x0308 */ u8 unk_308;
/* 0x030C */ ColliderCylinder collider;
- /* 0x0358 */ EnNiwFeather feathers[20];
+ /* 0x0358 */ EnNiwEffect effects[EN_NIW_EFFECT_COUNT];
} EnNiw; // size = 0x07B8
#endif
diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c
index 8a5fc27479..f8cc6fd843 100644
--- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c
+++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c
@@ -16,15 +16,15 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx);
void EnSyatekiNiw_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_80B11DEC(EnSyatekiNiw* this, GlobalContext* globalCtx);
-void func_80B132A8(EnSyatekiNiw* this, GlobalContext* globalCtx);
+void EnSyatekiNiw_UpdateEffects(EnSyatekiNiw* this, GlobalContext* globalCtx);
void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx);
-void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx);
+void EnSyatekiNiw_DrawEffects(EnSyatekiNiw* this, GlobalContext* globalCtx);
void func_80B123A8(EnSyatekiNiw* this, GlobalContext* globalCtx);
void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx);
void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx);
void func_80B128D8(EnSyatekiNiw* this, GlobalContext* globalCtx);
-void func_80B131B8(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4);
+void EnSyatekiNiw_SpawnFeather(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4);
const ActorInit En_Syateki_Niw_InitVars = {
ACTOR_EN_SYATEKI_NIW,
@@ -583,7 +583,7 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
if (1) {}
if (1) {}
- func_80B132A8(this, globalCtx);
+ EnSyatekiNiw_UpdateEffects(this, globalCtx);
this->unk_28C++;
if (this->unk_254 != 0) {
this->unk_254--;
@@ -632,7 +632,7 @@ void EnSyatekiNiw_Update(Actor* thisx, GlobalContext* globalCtx) {
sp6C.z = Rand_CenteredFloat(3.0f);
sp60.z = sp60.x = 0.0f;
sp60.y = -0.15f;
- func_80B131B8(this, &sp78, &sp6C, &sp60, Rand_ZeroFloat(8.0f) + 8.0f);
+ EnSyatekiNiw_SpawnFeather(this, &sp78, &sp6C, &sp60, Rand_ZeroFloat(8.0f) + 8.0f);
}
this->unk_2A0 = 0;
@@ -706,85 +706,85 @@ void EnSyatekiNiw_Draw(Actor* thisx, GlobalContext* globalCtx) {
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, SyatekiNiw_OverrideLimbDraw, NULL, this);
func_80026608(globalCtx);
- func_80B13464(this, globalCtx);
+ EnSyatekiNiw_DrawEffects(this, globalCtx);
}
}
-void func_80B131B8(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4) {
+void EnSyatekiNiw_SpawnFeather(EnSyatekiNiw* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, f32 arg4) {
s16 i;
- EnSyatekiNiw_1* ptr = &this->unk_348[0];
+ EnSyatekiNiwEffect* effect = &this->effects[0];
- for (i = 0; i < 5; i++, ptr++) {
- if (ptr->unk_00 == 0) {
- ptr->unk_00 = 1;
- ptr->unk_04 = *arg1;
- ptr->unk_10 = *arg2;
- ptr->unk_1C = *arg3;
- ptr->unk_34 = 0;
- ptr->unk_2C = (arg4 / 1000.0f);
- ptr->unk_28 = (s16)Rand_ZeroFloat(20.0f) + 0x28;
- ptr->unk_2A = Rand_ZeroFloat(1000.0f);
+ for (i = 0; i < EN_SYATEKI_NIW_EFFECT_COUNT; i++, effect++) {
+ if (effect->unk_00 == 0) {
+ effect->unk_00 = 1;
+ effect->unk_04 = *arg1;
+ effect->unk_10 = *arg2;
+ effect->unk_1C = *arg3;
+ effect->unk_34 = 0;
+ effect->unk_2C = (arg4 / 1000.0f);
+ effect->unk_28 = (s16)Rand_ZeroFloat(20.0f) + 0x28;
+ effect->unk_2A = Rand_ZeroFloat(1000.0f);
return;
}
}
}
-void func_80B132A8(EnSyatekiNiw* this, GlobalContext* globalCtx) {
+void EnSyatekiNiw_UpdateEffects(EnSyatekiNiw* this, GlobalContext* globalCtx) {
s16 i;
- EnSyatekiNiw_1* ptr = &this->unk_348[0];
+ EnSyatekiNiwEffect* effect = &this->effects[0];
- for (i = 0; i < 5; i++, ptr++) {
- if (ptr->unk_00 != 0) {
- ptr->unk_04.x += ptr->unk_10.x;
- ptr->unk_04.y += ptr->unk_10.y;
- ptr->unk_04.z += ptr->unk_10.z;
- ptr->unk_34++;
- ptr->unk_10.x += ptr->unk_1C.x;
- ptr->unk_10.y += ptr->unk_1C.y;
- ptr->unk_10.z += ptr->unk_1C.z;
- if (ptr->unk_00 == 1) {
- ptr->unk_2A++;
- Math_ApproachF(&ptr->unk_10.x, 0.0f, 1.0f, 0.05f);
- Math_ApproachF(&ptr->unk_10.z, 0.0f, 1.0f, 0.05f);
- if (ptr->unk_10.y < -0.5f) {
- ptr->unk_10.y = 0.5f;
+ for (i = 0; i < EN_SYATEKI_NIW_EFFECT_COUNT; i++, effect++) {
+ if (effect->unk_00 != 0) {
+ effect->unk_04.x += effect->unk_10.x;
+ effect->unk_04.y += effect->unk_10.y;
+ effect->unk_04.z += effect->unk_10.z;
+ effect->unk_34++;
+ effect->unk_10.x += effect->unk_1C.x;
+ effect->unk_10.y += effect->unk_1C.y;
+ effect->unk_10.z += effect->unk_1C.z;
+ if (effect->unk_00 == 1) {
+ effect->unk_2A++;
+ Math_ApproachF(&effect->unk_10.x, 0.0f, 1.0f, 0.05f);
+ Math_ApproachF(&effect->unk_10.z, 0.0f, 1.0f, 0.05f);
+ if (effect->unk_10.y < -0.5f) {
+ effect->unk_10.y = 0.5f;
}
- ptr->unk_30 = (Math_SinS(ptr->unk_2A * 3000) * M_PI) * 0.2f;
- if (ptr->unk_28 < ptr->unk_34) {
- ptr->unk_00 = 0;
+ effect->unk_30 = (Math_SinS(effect->unk_2A * 3000) * M_PI) * 0.2f;
+ if (effect->unk_28 < effect->unk_34) {
+ effect->unk_00 = 0;
}
}
}
}
}
-void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx) {
+void EnSyatekiNiw_DrawEffects(EnSyatekiNiw* this, GlobalContext* globalCtx) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
s16 i;
- EnSyatekiNiw_1* ptr = &this->unk_348[0];
- u8 flag = 0;
+ EnSyatekiNiwEffect* effect = &this->effects[0];
+ u8 materialFlag = 0;
OPEN_DISPS(gfxCtx, "../z_en_syateki_niw.c", 1234);
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < 5; i++, ptr++) {
- if (ptr->unk_00 == 1) {
- if (flag == 0) {
- gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAppearDL);
- flag++;
+ for (i = 0; i < EN_SYATEKI_NIW_EFFECT_COUNT; i++, effect++) {
+ if (effect->unk_00 == 1) {
+ if (materialFlag == 0) {
+ gSPDisplayList(POLY_XLU_DISP++, gCuccoEffectFeatherMaterialDL);
+ materialFlag++;
}
- Matrix_Translate(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW);
+ Matrix_Translate(effect->unk_04.x, effect->unk_04.y, effect->unk_04.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
- Matrix_Scale(ptr->unk_2C, ptr->unk_2C, 1.0f, MTXMODE_APPLY);
- Matrix_RotateZ(ptr->unk_30, MTXMODE_APPLY);
+ Matrix_Scale(effect->unk_2C, effect->unk_2C, 1.0f, MTXMODE_APPLY);
+ Matrix_RotateZ(effect->unk_30, MTXMODE_APPLY);
Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_syateki_niw.c", 1251),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, gCuccoParticleAliveDL);
+ gSPDisplayList(POLY_XLU_DISP++, gCuccoEffectFeatherModelDL);
}
}
diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h
index 6a6398a6f1..829d67fa25 100644
--- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h
+++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h
@@ -18,7 +18,9 @@ typedef struct {
/* 0x2C */ f32 unk_2C;
/* 0x30 */ f32 unk_30;
/* 0x34 */ u8 unk_34;
-} EnSyatekiNiw_1; // size = 0x38
+} EnSyatekiNiwEffect; // size = 0x38
+
+#define EN_SYATEKI_NIW_EFFECT_COUNT 5
typedef struct EnSyatekiNiw {
/* 0x0000 */ Actor actor;
@@ -65,7 +67,7 @@ typedef struct EnSyatekiNiw {
/* 0x02F4 */ f32 unk_2F4;
/* 0x02F8 */ u8 unk_2F8;
/* 0x02FC */ ColliderCylinder collider;
- /* 0x0348 */ EnSyatekiNiw_1 unk_348[5];
+ /* 0x0348 */ EnSyatekiNiwEffect effects[EN_SYATEKI_NIW_EFFECT_COUNT];
} EnSyatekiNiw; // size = 0x0460
#endif
diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
index 321a02799b..6ddc08a011 100644
--- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c
+++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
@@ -28,13 +28,13 @@ void EnZo_Surface(EnZo* this, GlobalContext* globalCtx);
void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx);
void EnZo_Dive(EnZo* this, GlobalContext* globalCtx);
-void EnZo_Ripple(EnZo* this, Vec3f* pos, f32 scale, f32 targetScale, u8 alpha) {
+void EnZo_SpawnRipple(EnZo* this, Vec3f* pos, f32 scale, f32 targetScale, u8 alpha) {
EnZoEffect* effect;
Vec3f vec = { 0.0f, 0.0f, 0.0f };
s16 i;
effect = this->effects;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++) {
+ for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) {
if (effect->type == ENZO_EFFECT_NONE) {
effect->type = ENZO_EFFECT_RIPPLE;
effect->pos = *pos;
@@ -47,7 +47,7 @@ void EnZo_Ripple(EnZo* this, Vec3f* pos, f32 scale, f32 targetScale, u8 alpha) {
}
}
-void EnZo_Bubble(EnZo* this, Vec3f* pos) {
+void EnZo_SpawnBubble(EnZo* this, Vec3f* pos) {
EnZoEffect* effect;
Vec3f vec = { 0.0f, 0.0f, 0.0f };
Vec3f vel = { 0.0f, 1.0f, 0.0f };
@@ -55,7 +55,7 @@ void EnZo_Bubble(EnZo* this, Vec3f* pos) {
f32 waterSurface;
effect = this->effects;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++) {
+ for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) {
if (1) {}
if (effect->type == ENZO_EFFECT_NONE) {
waterSurface = this->actor.world.pos.y + this->actor.yDistToWater;
@@ -72,13 +72,13 @@ void EnZo_Bubble(EnZo* this, Vec3f* pos) {
}
}
-void EnZo_Splash(EnZo* this, Vec3f* pos, Vec3f* vel, f32 scale) {
+void EnZo_SpawnSplash(EnZo* this, Vec3f* pos, Vec3f* vel, f32 scale) {
EnZoEffect* effect;
Vec3f accel = { 0.0f, -1.0f, 0.0f };
s16 i;
effect = this->effects;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++) {
+ for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) {
if (1) {}
if (effect->type != ENZO_EFFECT_SPLASH) {
effect->type = ENZO_EFFECT_SPLASH;
@@ -93,11 +93,11 @@ void EnZo_Splash(EnZo* this, Vec3f* pos, Vec3f* vel, f32 scale) {
}
}
-void EnZo_UpdateRipples(EnZo* this) {
+void EnZo_UpdateEffectsRipples(EnZo* this) {
EnZoEffect* effect = this->effects;
s16 i;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++) {
+ for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) {
if (effect->type == ENZO_EFFECT_RIPPLE) {
Math_ApproachF(&effect->scale, effect->targetScale, 0.2f, 0.8f);
if (effect->color.a > 20) {
@@ -114,13 +114,13 @@ void EnZo_UpdateRipples(EnZo* this) {
}
}
-void EnZo_UpdateBubbles(EnZo* this) {
+void EnZo_UpdateEffectsBubbles(EnZo* this) {
EnZoEffect* effect;
f32 waterSurface;
s16 i;
effect = this->effects;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++) {
+ for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) {
if (effect->type == ENZO_EFFECT_BUBBLE) {
effect->pos.x = ((Rand_ZeroOne() * 0.5f) - 0.25f) + effect->vec.x;
effect->pos.z = ((Rand_ZeroOne() * 0.5f) - 0.25f) + effect->vec.z;
@@ -131,20 +131,20 @@ void EnZo_UpdateBubbles(EnZo* this) {
if (waterSurface <= effect->pos.y) {
effect->type = ENZO_EFFECT_NONE;
effect->pos.y = waterSurface;
- EnZo_Ripple(this, &effect->pos, 0.06f, 0.12f, 200);
+ EnZo_SpawnRipple(this, &effect->pos, 0.06f, 0.12f, 200);
}
}
effect++;
}
}
-void EnZo_UpdateSplashes(EnZo* this) {
+void EnZo_UpdateEffectsSplashes(EnZo* this) {
EnZoEffect* effect;
f32 waterSurface;
s16 i;
effect = this->effects;
- for (i = 0; i < ARRAY_COUNT(this->effects); i++) {
+ for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) {
if (effect->type == ENZO_EFFECT_SPLASH) {
effect->pos.x += effect->vel.x;
effect->pos.y += effect->vel.y;
@@ -162,30 +162,30 @@ void EnZo_UpdateSplashes(EnZo* this) {
if (effect->pos.y < waterSurface) {
effect->type = ENZO_EFFECT_NONE;
effect->pos.y = waterSurface;
- EnZo_Ripple(this, &effect->pos, 0.06f, 0.12f, 200);
+ EnZo_SpawnRipple(this, &effect->pos, 0.06f, 0.12f, 200);
}
}
effect++;
}
}
-void EnZo_DrawRipples(EnZo* this, GlobalContext* globalCtx) {
+void EnZo_DrawEffectsRipples(EnZo* this, GlobalContext* globalCtx) {
EnZoEffect* effect;
s16 i;
- u8 setup;
+ u8 materialFlag;
effect = this->effects;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 217);
- setup = false;
+ materialFlag = false;
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < ARRAY_COUNT(this->effects); i++) {
+ for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) {
if (effect->type == ENZO_EFFECT_RIPPLE) {
- if (!setup) {
+ if (!materialFlag) {
if (1) {}
gDPPipeSync(POLY_XLU_DISP++);
gSPDisplayList(POLY_XLU_DISP++, gZoraRipplesMaterialDL);
gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0);
- setup = true;
+ materialFlag = true;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->color.a);
@@ -200,24 +200,24 @@ void EnZo_DrawRipples(EnZo* this, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 248);
}
-void EnZo_DrawBubbles(EnZo* this, GlobalContext* globalCtx) {
+void EnZo_DrawEffectsBubbles(EnZo* this, GlobalContext* globalCtx) {
EnZoEffect* effect = this->effects;
s16 i;
- u8 setup;
+ u8 materialFlag;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 260);
- setup = false;
+ materialFlag = false;
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < ARRAY_COUNT(this->effects); i++) {
+ for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) {
if (effect->type == ENZO_EFFECT_BUBBLE) {
- if (!setup) {
+ if (!materialFlag) {
if (1) {}
gSPDisplayList(POLY_XLU_DISP++, gZoraBubblesMaterialDL);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 150, 150, 150, 0);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
- setup = true;
+ materialFlag = true;
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
@@ -233,23 +233,23 @@ void EnZo_DrawBubbles(EnZo* this, GlobalContext* globalCtx) {
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 286);
}
-void EnZo_DrawSplashes(EnZo* this, GlobalContext* globalCtx) {
+void EnZo_DrawEffectsSplashes(EnZo* this, GlobalContext* globalCtx) {
EnZoEffect* effect;
s16 i;
- u8 setup;
+ u8 materialFlag;
effect = this->effects;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 298);
- setup = false;
+ materialFlag = false;
func_80093D84(globalCtx->state.gfxCtx);
- for (i = 0; i < ARRAY_COUNT(this->effects); i++) {
+ for (i = 0; i < EN_ZO_EFFECT_COUNT; i++) {
if (effect->type == ENZO_EFFECT_SPLASH) {
- if (!setup) {
+ if (!materialFlag) {
if (1) {}
gSPDisplayList(POLY_XLU_DISP++, gZoraSplashesMaterialDL);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 200, 0);
- setup = true;
+ materialFlag = true;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->color.a);
@@ -272,7 +272,7 @@ void EnZo_TreadWaterRipples(EnZo* this, f32 scale, f32 targetScale, u8 alpha) {
pos.x = this->actor.world.pos.x;
pos.y = this->actor.world.pos.y + this->actor.yDistToWater;
pos.z = this->actor.world.pos.z;
- EnZo_Ripple(this, &pos, scale, targetScale, alpha);
+ EnZo_SpawnRipple(this, &pos, scale, targetScale, alpha);
}
static ColliderCylinderInit sCylinderInit = {
@@ -350,7 +350,7 @@ void EnZo_SpawnSplashes(EnZo* this) {
pos.x += vel.x * 6.0f;
pos.z += vel.z * 6.0f;
pos.y += this->actor.yDistToWater;
- EnZo_Splash(this, &pos, &vel, 0.08f);
+ EnZo_SpawnSplash(this, &pos, &vel, 0.08f);
}
}
@@ -737,7 +737,7 @@ void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) {
pos.y += (Rand_ZeroOne() - 0.5f) * 10.0f + 18.0f;
pos.x += (Rand_ZeroOne() - 0.5f) * 28.0f;
pos.z += (Rand_ZeroOne() - 0.5f) * 28.0f;
- EnZo_Bubble(this, &pos);
+ EnZo_SpawnBubble(this, &pos);
}
if ((s32)this->alpha != 0) {
@@ -745,9 +745,9 @@ void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
- EnZo_UpdateRipples(this);
- EnZo_UpdateBubbles(this);
- EnZo_UpdateSplashes(this);
+ EnZo_UpdateEffectsRipples(this);
+ EnZo_UpdateEffectsBubbles(this);
+ EnZo_UpdateEffectsSplashes(this);
}
s32 EnZo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx,
@@ -791,9 +791,9 @@ void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) {
void* eyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex };
Matrix_Push();
- EnZo_DrawRipples(this, globalCtx);
- EnZo_DrawBubbles(this, globalCtx);
- EnZo_DrawSplashes(this, globalCtx);
+ EnZo_DrawEffectsRipples(this, globalCtx);
+ EnZo_DrawEffectsBubbles(this, globalCtx);
+ EnZo_DrawEffectsSplashes(this, globalCtx);
Matrix_Pop();
if ((s32)this->alpha != 0) {
diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h
index ba6eebb30c..87e0d474e8 100644
--- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h
+++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h
@@ -6,6 +6,8 @@
struct EnZo;
+#define EN_ZO_EFFECT_COUNT 15
+
typedef struct {
/* 0x00 */ u8 type;
/* 0x04 */ f32 scale;
@@ -28,7 +30,7 @@ typedef struct EnZo {
/* 0x0208 */ u8 canSpeak;
/* 0x020A */ Vec3s jointTable[20];
/* 0x0282 */ Vec3s morphTable[20];
- /* 0x02FC */ EnZoEffect effects[15];
+ /* 0x02FC */ EnZoEffect effects[EN_ZO_EFFECT_COUNT];
/* 0x0644 */ f32 dialogRadius;
/* 0x0648 */ f32 alpha;
/* 0x064C */ s16 unk_64C;
diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c
index d28e7eb409..641ac91a46 100644
--- a/src/overlays/actors/ovl_Fishing/z_fishing.c
+++ b/src/overlays/actors/ovl_Fishing/z_fishing.c
@@ -28,8 +28,6 @@ typedef struct {
/* 0x0C */ f32 unk_0C;
} FishingFishInit; // size = 0x10
-#define EFFECT_COUNT 130
-
typedef enum {
/* 0x00 */ FS_EFF_NONE,
/* 0x01 */ FS_EFF_RIPPLE,
@@ -42,6 +40,8 @@ typedef enum {
/* 0x08 */ FS_EFF_RAIN_SPLASH
} FishingEffectType;
+#define FISHING_EFFECT_COUNT 130
+
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f vel;
@@ -409,7 +409,7 @@ static FishingGroupFish sGroupFishes[GROUP_FISH_COUNT];
static f32 sFishGroupAngle1;
static f32 sFishGroupAngle2;
static f32 sFishGroupAngle3;
-static FishingEffect sFishingEffects[EFFECT_COUNT];
+static FishingEffect sEffects[FISHING_EFFECT_COUNT];
static Vec3f sStreamSoundProjectedPos;
void Fishing_SetColliderElement(s32 index, ColliderJntSph* collider, Vec3f* pos, f32 scale) {
@@ -579,7 +579,7 @@ void Fishing_SpawnRainDrop(FishingEffect* effect, Vec3f* pos, Vec3f* rot) {
effect += 30;
- for (i = 30; i < EFFECT_COUNT; i++) {
+ for (i = 30; i < FISHING_EFFECT_COUNT; i++) {
if (effect->type == FS_EFF_NONE) {
effect->type = FS_EFF_RAIN_DROP;
effect->pos = *pos;
@@ -862,7 +862,7 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) {
}
D_80B7A684 = 20;
- globalCtx->specialEffects = sFishingEffects;
+ globalCtx->specialEffects = sEffects;
gTimeIncrement = 1;
D_80B7E0AC = 0;
D_80B7E0A6 = 10;
@@ -903,8 +903,8 @@ void Fishing_Init(Actor* thisx, GlobalContext* globalCtx2) {
D_80B7E077 = 0;
}
- for (i = 0; i < EFFECT_COUNT; i++) {
- sFishingEffects[i].type = FS_EFF_NONE;
+ for (i = 0; i < FISHING_EFFECT_COUNT; i++) {
+ sEffects[i].type = FS_EFF_NONE;
}
for (i = 0; i < POND_PROP_COUNT; i++) {
@@ -1024,7 +1024,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) {
f32 rippleY;
s16 i;
- for (i = 0; i < EFFECT_COUNT; i++) {
+ for (i = 0; i < FISHING_EFFECT_COUNT; i++) {
if (effect->type) {
effect->timer++;
effect->pos.x += effect->vel.x;
@@ -1167,7 +1167,7 @@ void Fishing_UpdateEffects(FishingEffect* effect, GlobalContext* globalCtx) {
}
void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) {
- u8 flag = 0;
+ u8 materialFlag = 0;
f32 rotY;
s16 i;
s32 pad;
@@ -1181,10 +1181,10 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) {
for (i = 0; i < 100; i++) {
if (effect->type == FS_EFF_RIPPLE) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, gFishingRippleMaterialDL);
gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->alpha);
@@ -1201,13 +1201,13 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) {
}
effect = firstEffect;
- flag = 0;
+ materialFlag = 0;
for (i = 0; i < 100; i++) {
if (effect->type == FS_EFF_DUST_SPLASH) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, gFishingDustSplashMaterialDL);
gDPSetEnvColor(POLY_XLU_DISP++, 200, 200, 200, 0);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->alpha);
@@ -1225,13 +1225,13 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) {
}
effect = firstEffect;
- flag = 0;
+ materialFlag = 0;
for (i = 0; i < 100; i++) {
if (effect->type == FS_EFF_WATER_DUST) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_OPA_DISP++, gFishingWaterDustMaterialDL);
gDPSetEnvColor(POLY_OPA_DISP++, 40, 90, 80, 128);
- flag++;
+ materialFlag++;
}
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 40, 90, 80, effect->alpha);
@@ -1253,14 +1253,14 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) {
}
effect = firstEffect;
- flag = 0;
+ materialFlag = 0;
for (i = 0; i < 100; i++) {
if (effect->type == FS_EFF_BUBBLE) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, gFishingBubbleMaterialDL);
gDPSetEnvColor(POLY_XLU_DISP++, 150, 150, 150, 0);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
- flag++;
+ materialFlag++;
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
@@ -1276,14 +1276,14 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) {
}
effect = firstEffect + 30;
- flag = 0;
- for (i = 30; i < EFFECT_COUNT; i++) {
+ materialFlag = 0;
+ for (i = 30; i < FISHING_EFFECT_COUNT; i++) {
if (effect->type == FS_EFF_RAIN_DROP) {
- if (flag == 0) {
+ if (materialFlag == 0) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14);
gDPSetCombineMode(POLY_XLU_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 150, 255, 255, 30);
- flag++;
+ materialFlag++;
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
@@ -1303,14 +1303,14 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) {
func_80093D84(globalCtx->state.gfxCtx);
effect = firstEffect + 30;
- flag = 0;
- for (i = 30; i < EFFECT_COUNT; i++) {
+ materialFlag = 0;
+ for (i = 30; i < FISHING_EFFECT_COUNT; i++) {
if (effect->type == FS_EFF_RAIN_RIPPLE) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, gFishingRippleMaterialDL);
gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 130);
- flag++;
+ materialFlag++;
}
Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW);
@@ -1325,13 +1325,13 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) {
}
effect = firstEffect + 30;
- flag = 0;
- for (i = 30; i < EFFECT_COUNT; i++) {
+ materialFlag = 0;
+ for (i = 30; i < FISHING_EFFECT_COUNT; i++) {
if (effect->type == FS_EFF_RAIN_SPLASH) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, gFishingRainSplashMaterialDL);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, KREG(19) + 80);
- flag++;
+ materialFlag++;
}
if (Rand_ZeroOne() < 0.5f) {
@@ -4386,7 +4386,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) {
}
void Fishing_DrawPondProps(GlobalContext* globalCtx) {
- u8 flag = 0;
+ u8 materialFlag = 0;
FishingProp* prop = &sPondProps[0];
s16 i;
s32 pad;
@@ -4397,9 +4397,9 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) {
for (i = 0; i < POND_PROP_COUNT; i++) {
if (prop->type == FS_PROP_REED) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, gFishingReedMaterialDL);
- flag++;
+ materialFlag++;
}
if (prop->shouldDraw) {
@@ -4419,12 +4419,12 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) {
}
prop = &sPondProps[0];
- flag = 0;
+ materialFlag = 0;
for (i = 0; i < POND_PROP_COUNT; i++) {
if (prop->type == FS_PROP_WOOD_POST) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_OPA_DISP++, gFishingWoodPostMaterialDL);
- flag++;
+ materialFlag++;
}
if (prop->shouldDraw) {
@@ -4441,12 +4441,12 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) {
}
prop = &sPondProps[0];
- flag = 0;
+ materialFlag = 0;
for (i = 0; i < POND_PROP_COUNT; i++) {
if (prop->type == FS_PROP_LILY_PAD) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_XLU_DISP++, gFishingLilyPadMaterialDL);
- flag++;
+ materialFlag++;
}
if (prop->shouldDraw) {
@@ -4466,12 +4466,12 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) {
}
prop = &sPondProps[0];
- flag = 0;
+ materialFlag = 0;
for (i = 0; i < POND_PROP_COUNT; i++) {
if (prop->type == FS_PROP_ROCK) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_OPA_DISP++, gFishingRockMaterialDL);
- flag++;
+ materialFlag++;
}
if (prop->shouldDraw) {
@@ -4680,7 +4680,7 @@ void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) {
}
void Fishing_DrawGroupFishes(GlobalContext* globalCtx) {
- u8 flag = 0;
+ u8 materialFlag = 0;
FishingGroupFish* fish = &sGroupFishes[0];
f32 scale;
s16 i;
@@ -4698,10 +4698,10 @@ void Fishing_DrawGroupFishes(GlobalContext* globalCtx) {
for (i = 0; i < GROUP_FISH_COUNT; i++) {
if (fish->type != FS_GROUP_FISH_NONE) {
- if (flag == 0) {
+ if (materialFlag == 0) {
gSPDisplayList(POLY_OPA_DISP++, gFishingGroupFishMaterialDL);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 155, 155, 155, 255);
- flag++;
+ materialFlag++;
}
if (fish->shouldDraw) {
diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c
index 6f902ff98c..3184d7340c 100644
--- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c
+++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c
@@ -46,8 +46,8 @@ void FileChoose_SetKeyboardVtx(GameState* thisx) {
phi_t0 = -0x60;
for (phi_t1 = 0; phi_t1 < 13; phi_t1++, phi_t3 += 4, phi_t2++) {
- //! @bug D_80812544 is accessed out of bounds when drawing the empty space character (value of 64). Under normal
- //! circumstances it reads a halfword from sNameLabelTextures.
+ //! @bug D_80812544 is accessed out of bounds when drawing the empty space character (value of 64). Under
+ //! normal circumstances it reads a halfword from sNameLabelTextures.
this->keyboardVtx[phi_t3].v.ob[0] = this->keyboardVtx[phi_t3 + 2].v.ob[0] = D_80812544[phi_t2] + phi_t0;
this->keyboardVtx[phi_t3 + 1].v.ob[0] = this->keyboardVtx[phi_t3 + 3].v.ob[0] =