mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-23 07:21:19 +00:00
Cleanup pass on in-actor effects systems (#1167)
* Name in-actor effect functions / improve naming consistency "particle" -> "effect" Fixup: consistent effect functions names, missed a bunch * Use `materialFlag` as int for the "is material already set" "boolean" Fixup `materialFlag` (actually a boolean one), and `objectFlag` More actually boolean `materialFlag`s * Consistently use `_EFFECTS_COUNT` defines (except partial buffer usage, for now) `BOSSFD_EFFECT_COUNT` -> `BOSSFD_EFFECTS_COUNT` `EFFECT_COUNT` -> `FISHING_EFFECTS_COUNT` Place `_EFFECTS_COUNT` defines before effect struct definition * Name `countLimit` the "max new effect index" argument * Rename all effect buffers to `effects`/`sEffects` * Fixup some array/pointer usage * `EnNiw` also has this pseudo-effects system * `EnSyatekiNiw` also has this pseudo-effects system * `EnFz` also has this pseudo-effects system * `_EFFECTS_COUNT` -> `_EFFECT_COUNT` * `effects` -> `effect` where used as iterator (hopefully covers everything) * Run formatter
This commit is contained in:
parent
7068ad3703
commit
76cffddf29
43 changed files with 871 additions and 833 deletions
|
@ -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) &&
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue