summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Hensley <hensley.derek58@gmail.com>2021-08-08 20:08:01 -0700
committerGitHub <noreply@github.com>2021-08-08 23:08:01 -0400
commit3bac4232fdd448288b7c25eb2fdced324da1e986 (patch)
treeb7b5a2f7582b6a56d35783be197a7a5c3371a2e0 /src
parent823281291bf046a9c10159d8e2c72de38fa4643c (diff)
Matched last function in Ovl_en_encount2 (#252)
* Matched last function * Format * Fix Gfx arrays
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_En_Encount2/z_en_encount2.c68
1 files changed, 38 insertions, 30 deletions
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 81a89ecf2..b61b73c58 100644
--- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
+++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
@@ -13,7 +13,7 @@ void EnEncount2_Idle(EnEncount2* this, GlobalContext* globalCtx);
void EnEncount2_Popped(EnEncount2* this, GlobalContext* globalCtx);
void EnEncount2_Die(EnEncount2* this, GlobalContext* globalCtx);
void EnEncount2_SetIdle(EnEncount2* this);
-void EnEncount2_InitParticles(EnEncount2* this, Vec3f* vec, s16 fadeDelay);
+void EnEncount2_InitParticles(EnEncount2* this, Vec3f* pos, s16 fadeDelay);
void EnEncount2_UpdateParticles(EnEncount2* this, GlobalContext* globalCtx);
void EnEncount2_DrawParticles(EnEncount2* this, GlobalContext* globalCtx);
@@ -104,7 +104,7 @@ void EnEncount2_Init(Actor* thisx, GlobalContext* globalCtx) {
BgCheck_RelocateMeshHeader(&D_06002420, &colHeader);
this->dyna.bgId = BgCheck_AddActorMesh(globalCtx, &globalCtx->colCtx.dyna, &this->dyna, colHeader);
ActorShape_Init(&this->dyna.actor.shape, 0.0f, func_800B3FC0, 25.0f);
- this->dyna.actor.colChkInfo.mass = 0xFF;
+ this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE;
Collider_InitAndSetJntSph(globalCtx, &this->collider, &this->dyna.actor, &sJntSphInit, &this->colElement);
this->dyna.actor.targetMode = 6;
@@ -138,7 +138,7 @@ void EnEncount2_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void EnEncount2_SetIdle(EnEncount2* this) {
- this->isPopped = 0;
+ this->isPopped = false;
this->actionFunc = EnEncount2_Idle;
}
@@ -148,7 +148,7 @@ void EnEncount2_Idle(EnEncount2* this, GlobalContext* globalCtx) {
Math_ApproachF(&this->scale, 0.1f, 0.3f, 0.01f);
if ((this->collider.base.acFlags & AC_HIT) && (this->dyna.actor.colChkInfo.damageEffect == 0xE)) {
this->dyna.actor.colChkInfo.health = 0;
- this->isPopped = 1;
+ this->isPopped = true;
this->actionFunc = EnEncount2_Popped;
}
}
@@ -162,7 +162,7 @@ void EnEncount2_Popped(EnEncount2* this, GlobalContext* globalCtx) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, curPos.x, curPos.y, curPos.z, 255, 255, 200,
CLEAR_TAG_LARGE_EXPLOSION);
- for (i = 0; i != 100; ++i) {
+ for (i = 0; i < ARRAY_COUNT(this->particles) / 2; ++i) {
EnEncount2_InitParticles(this, &curPos, 10);
}
@@ -202,21 +202,21 @@ void EnEncount2_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnEncount2_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnEncount2* this = THIS;
- if (this->isPopped != 1) {
+ if (this->isPopped != true) {
func_800BDFC0(globalCtx, D_06000A00);
func_800BDFC0(globalCtx, D_06000D78);
}
EnEncount2_DrawParticles(this, globalCtx);
}
-void EnEncount2_InitParticles(EnEncount2* this, Vec3f* vec, s16 fadeDelay) {
+void EnEncount2_InitParticles(EnEncount2* this, Vec3f* pos, s16 fadeDelay) {
s16 i;
EnEncount2Particle* sPtr = this->particles;
- for (i = 0; i < 200; ++i) {
+ for (i = 0; i < ARRAY_COUNT(this->particles); i++, sPtr++) {
if (!sPtr->enabled) {
- sPtr->enabled = 1;
- sPtr->pos = *vec;
+ sPtr->enabled = true;
+ sPtr->pos = *pos;
sPtr->alphaFadeDelay = fadeDelay;
sPtr->alpha = 0xFF;
@@ -231,7 +231,6 @@ void EnEncount2_InitParticles(EnEncount2* this, Vec3f* vec, s16 fadeDelay) {
sPtr->scale = (Rand_ZeroFloat(1.0f) * 0.5f) + 2.0f;
return;
}
- sPtr++;
}
}
@@ -239,7 +238,7 @@ void EnEncount2_UpdateParticles(EnEncount2* this, GlobalContext* globalCtx) {
s32 i;
EnEncount2Particle* sPtr = this->particles;
- for (i = 0; i < 200; i += 2) {
+ for (i = 0; i < ARRAY_COUNT(this->particles); i++, sPtr++) {
if (sPtr->enabled) {
sPtr->pos.x += sPtr->vel.x;
sPtr->pos.y += sPtr->vel.y;
@@ -247,6 +246,7 @@ void EnEncount2_UpdateParticles(EnEncount2* this, GlobalContext* globalCtx) {
sPtr->vel.x += sPtr->accel.x;
sPtr->vel.y += sPtr->accel.y;
sPtr->vel.z += sPtr->accel.z;
+
if (sPtr->alphaFadeDelay != 0) {
sPtr->alphaFadeDelay--;
} else {
@@ -256,26 +256,34 @@ void EnEncount2_UpdateParticles(EnEncount2* this, GlobalContext* globalCtx) {
}
}
}
- sPtr++;
+ }
+}
+void EnEncount2_DrawParticles(EnEncount2* this, GlobalContext* globalCtx) {
+ s16 i;
+ EnEncount2Particle* sPtr;
+ GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
+
+ OPEN_DISPS(gfxCtx);
+ sPtr = this->particles;
+ func_8012C28C(gfxCtx);
+ func_8012C2DC(globalCtx->state.gfxCtx);
+ for (i = 0; i < ARRAY_COUNT(this->particles); i++, sPtr++) {
if (sPtr->enabled) {
- sPtr->pos.x += sPtr->vel.x;
- sPtr->pos.y += sPtr->vel.y;
- sPtr->pos.z += sPtr->vel.z;
- sPtr->vel.x += sPtr->accel.x;
- sPtr->vel.y += sPtr->accel.y;
- sPtr->vel.z += sPtr->accel.z;
- if (sPtr->alphaFadeDelay != 0) {
- sPtr->alphaFadeDelay--;
- } else {
- sPtr->alpha -= 10;
- if (sPtr->alpha < 10) {
- sPtr->enabled = 0;
- }
- }
+ SysMatrix_InsertTranslation(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW);
+ Matrix_Scale(sPtr->scale, sPtr->scale, sPtr->scale, MTXMODE_APPLY);
+ POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20);
+ gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(&D_04079B10));
+ gSPDisplayList(POLY_XLU_DISP++, D_0407AB10);
+ gDPPipeSync(POLY_XLU_DISP++);
+ gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
+ gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha);
+ SysMatrix_InsertMatrix(&globalCtx->mf_187FC, MTXMODE_APPLY);
+ SysMatrix_InsertZRotation_f(DEGTORAD(globalCtx->state.frames * 20.0f), MTXMODE_APPLY);
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, D_0407AB58);
}
- sPtr++;
}
+ CLOSE_DISPS(gfxCtx);
}
-
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount2/EnEncount2_DrawParticles.s")