diff --git a/include/functions.h b/include/functions.h index 1fc1935091..6cd05f12d5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -544,7 +544,7 @@ void EffectSsGRipple_Spawn(PlayState* play, Vec3f* pos, s16 radius, s16 radiusMa void EffectSsGSplash_Spawn(PlayState* play, Vec3f* pos, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 type, s16 scale); // void EffectSsGFire_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2); // void EffectSsLightning_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Color_RGBA8* pzParm3, Color_RGBA8* pzParm4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8); -// void EffectSsDtBubble_SpawnColorProfile(UNK_TYPE4 param_1, Vec3f* param_2, Vec3f* param_3, Vec3f* param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8); +void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 life, s16 colorProfile, s16 randXZ); void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s16 scale, s16 life, s16 randXZ); void EffectSsHahen_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 flags, s16 scale, s16 objId, s16 life, Gfx* dList); void EffectSsHahen_SpawnBurst(PlayState* play, Vec3f* pos, f32 burstScale, s16 flags, s16 scale, s16 randScaleRange, s16 count, s16 objId, s16 life, Gfx* dList); diff --git a/spec b/spec index bc27fa47ed..8202925c8a 100644 --- a/spec +++ b/spec @@ -744,8 +744,7 @@ beginseg name "ovl_En_Part" compress include "build/src/overlays/actors/ovl_En_Part/z_en_part.o" - include "build/data/ovl_En_Part/ovl_En_Part.data.o" - include "build/data/ovl_En_Part/ovl_En_Part.reloc.o" + include "build/src/overlays/actors/ovl_En_Part/ovl_En_Part_reloc.o" endseg beginseg diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 273581621d..4ba99cec9d 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3545,7 +3545,7 @@ void Actor_SpawnBodyParts(Actor* actor, PlayState* play, s32 arg2, Gfx** dList) part = (EnPart*)spawnedPart; Matrix_MtxFToYXZRot(currentMatrix, &part->actor.shape.rot, false); - part->unk_150 = *dList; + part->dList = *dList; Math_Vec3f_Copy(&part->actor.scale, &actor->scale); } } diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index 2967f36451..a2f2c618fa 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -15,7 +15,9 @@ void EnPart_Destroy(Actor* thisx, PlayState* play); void EnPart_Update(Actor* thisx, PlayState* play); void EnPart_Draw(Actor* thisx, PlayState* play); -#if 0 +void func_80865390(EnPart* this, PlayState* play); +void func_808654C4(EnPart* this, PlayState* play); + const ActorInit En_Part_InitVars = { ACTOR_EN_PART, ACTORCAT_ITEMACTION, @@ -28,16 +30,109 @@ const ActorInit En_Part_InitVars = { (ActorFunc)EnPart_Draw, }; -#endif +void EnPart_Init(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Part/EnPart_Init.s") +void EnPart_Destroy(Actor* thisx, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Part/EnPart_Destroy.s") +void func_80865390(EnPart* this, PlayState* play) { + this->actionFuncIndex = 1; + this->actor.world.rot.y = Rand_ZeroOne() * 20000.0f; + switch (this->actor.params) { + case ENPART_TYPE_1: + case ENPART_TYPE_4: + this->unk146 += (s16)(Rand_ZeroOne() * 17.0f) + 5; + this->actor.velocity.y = Rand_ZeroOne() * 5.0f + 4.0f; + this->actor.gravity = -0.6f - (Rand_ZeroOne() * 0.5f); + this->unk14C = 0.15f; + break; + case ENPART_TYPE_15: + this->actor.world.rot.y = this->actor.parent->shape.rot.y + 0x8000; + this->unk146 = 100; + this->actor.velocity.y = 7.0f; + this->actor.speedXZ = 2.0f; + this->actor.gravity = -1.0f; + break; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Part/func_80865390.s") +void func_808654C4(EnPart* this, PlayState* play) { + s16 effectScale; + Vec3f effectPos; + Vec3f effectVelocity = { 0.0f, 0.0f, 0.0f }; + s32 i; + Vec3f pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Part/func_808654C4.s") + if (this->actor.params == ENPART_TYPE_15) { + this->unk146--; + if (this->unk146 > 0) { + this->actor.shape.rot.x += 0x3A98; + this->actor.shape.rot.y = this->actor.shape.rot.y; + this->actor.shape.rot.z = this->actor.shape.rot.z; + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->actor.world.pos, 20.0f)) { + this->unk146 = 0; + } + } else { + Math_Vec3f_Copy(&pos, &this->actor.world.pos); + pos.y = this->actor.floorHeight; + func_800B3030(play, &pos, &gZeroVec3f, &gZeroVec3f, this->actor.scale.y * 1400.0f, 7, 0); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 10, NA_SE_EN_EXTINCT); + Actor_MarkForDeath(&this->actor); + } + } else if (this->unk146 <= 0) { + switch (this->actor.params) { + case ENPART_TYPE_1: + func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, this->actor.scale.y * 4000.0f, 7, + 1); + SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 10, NA_SE_EN_EXTINCT); + break; + case ENPART_TYPE_4: + for (i = 7; i >= 0; i--) { + effectPos.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; + effectPos.y = randPlusMinusPoint5Scaled(50.0f) + + (this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y)); + effectPos.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; + effectVelocity.y = Rand_ZeroOne() + 1.0f; + effectScale = Rand_S16Offset(80, 100); + EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &gZeroVec3f, effectScale, 25, + 0, 1); + } + break; + } + Actor_MarkForDeath(&this->actor); + } else { + this->unk146--; + this->zRot += this->unk14C; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Part/EnPart_Update.s") +EnPartActionFunc sActionFuncs[] = { func_80865390, func_808654C4 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Part/EnPart_Draw.s") +void EnPart_Update(Actor* thisx, PlayState* play) { + EnPart* this = THIS; + + Actor_MoveWithGravity(&this->actor); + (*sActionFuncs[this->actionFuncIndex])(this, play); +} + +void EnPart_Draw(Actor* thisx, PlayState* play) { + EnPart* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + if (this->actor.params > ENPART_TYPE_0) { + Matrix_RotateZF(this->zRot, MTXMODE_APPLY); + } + func_8012C28C(play->state.gfxCtx); + func_800B8050(&this->actor, play, 0); + if (this->actor.params == ENPART_TYPE_15) { + gSPSegment(POLY_OPA_DISP++, 0x0C, gEmptyDL); + } + if (this->dList != NULL) { + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, this->dList); + } + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.h b/src/overlays/actors/ovl_En_Part/z_en_part.h index fa3dd410f1..53a03f281f 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.h +++ b/src/overlays/actors/ovl_En_Part/z_en_part.h @@ -5,10 +5,22 @@ struct EnPart; +typedef void (*EnPartActionFunc)(struct EnPart*, PlayState*); + +typedef enum { + ENPART_TYPE_0 = 0, + ENPART_TYPE_1 = 1, + ENPART_TYPE_4 = 4, + ENPART_TYPE_15 = 15 +} EnPartParams; + typedef struct EnPart { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0xC]; - /* 0x150 */ Gfx* unk_150; + /* 0x144 */ u8 actionFuncIndex; + /* 0x146 */ s16 unk146; + /* 0x148 */ f32 zRot; + /* 0x14C */ f32 unk14C; + /* 0x150 */ Gfx* dList; } EnPart; // size = 0x154 extern const ActorInit En_Part_InitVars;