diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-02-14 15:37:22 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-14 15:37:22 -0500 |
| commit | 5bc23f58f80cdce021008ec798c6ac3e5f4a6bf0 (patch) | |
| tree | 6ca88dc4a45a49310d1bc5f1a54c473425154f7c /src | |
| parent | 97cfe4979740b05a2c6d78735e81bfb4787f531b (diff) | |
ovl_En_Anubice_Fire OK (#687)
* init, destroy and other func
Signed-off-by: angie <angheloalf95@gmail.com>
* func_809B2B48
Signed-off-by: angie <angheloalf95@gmail.com>
* EnAnubiceFire_Update
Signed-off-by: angie <angheloalf95@gmail.com>
* EnAnubiceFire_Draw NON_MATCHING
Signed-off-by: angie <angheloalf95@gmail.com>
* import data
Signed-off-by: angie <angheloalf95@gmail.com>
* inline some static variables
Signed-off-by: angie <angheloalf95@gmail.com>
* EnAnubiceFire_Draw
Signed-off-by: angie <angheloalf95@gmail.com>
* func_809B27D8
Signed-off-by: angie <angheloalf95@gmail.com>
* final cleanup
Signed-off-by: angie <angheloalf95@gmail.com>
* ups
Signed-off-by: angie <angheloalf95@gmail.com>
* changes requested by @petrie911
Signed-off-by: angie <angheloalf95@gmail.com>
* changes requested by @Roman971
Signed-off-by: angie <angheloalf95@gmail.com>
* I somehow forgot to delete that file
Signed-off-by: angie <angheloalf95@gmail.com>
* i don't know what to put in this message
Signed-off-by: angie <angheloalf95@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c | 214 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h | 12 |
2 files changed, 214 insertions, 12 deletions
diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index 7b39b5459..92c77bafc 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -16,9 +16,12 @@ void EnAnubiceFire_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx); void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx); -extern UNK_TYPE D_06003510; +void func_809B26EC(EnAnubiceFire* this, GlobalContext* globalCtx); +void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx); +void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx); + +extern Gfx D_06003510[]; -/* const ActorInit En_Anubice_Fire_InitVars = { ACTOR_EN_ANUBICE_FIRE, ACTORCAT_ENEMY, @@ -31,7 +34,7 @@ const ActorInit En_Anubice_Fire_InitVars = { (ActorFunc)EnAnubiceFire_Draw, }; -static ColliderCylinderInit D_809B31E0 = { +static ColliderCylinderInit sCylinderInit = { { COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, @@ -50,17 +53,206 @@ static ColliderCylinderInit D_809B31E0 = { }, { 0, 0, 0, { 0, 0, 0 } }, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Anubice_Fire/EnAnubiceFire_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Anubice_Fire/EnAnubiceFire_Destroy.s") +void EnAnubiceFire_Init(Actor* thisx, GlobalContext* globalCtx) { + EnAnubiceFire* this = THIS; + s32 i; + + Collider_InitCylinder(globalCtx, &this->cylinder); + Collider_SetCylinder(globalCtx, &this->cylinder, &this->actor, &sCylinderInit); + + this->unk_15A = 30; + this->unk_154 = 2.0f; + this->scale = 0.0f; + + for (i = 0; i < 6; i++) { + this->unk_160[i] = this->actor.world.pos; + } + + this->unk_15E = 0; + this->actionFunc = func_809B26EC; +} + +void EnAnubiceFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnAnubiceFire* this = THIS; + + Collider_DestroyCylinder(globalCtx, &this->cylinder); +} + +void func_809B26EC(EnAnubiceFire* this, GlobalContext* globalCtx) { + Vec3f velocity = { 0.0f, 0.0f, 0.0f }; + + Matrix_Push(); + Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_NEW); + Matrix_RotateX(BINANG_TO_RAD(this->actor.world.rot.x), MTXMODE_APPLY); + velocity.z = 15.0f; + Matrix_MultVec3f(&velocity, &this->actor.velocity); + Matrix_Pull(); + + this->actionFunc = func_809B27D8; + this->actor.world.rot.x = this->actor.world.rot.y = this->actor.world.rot.z = 0; +} + +void func_809B27D8(EnAnubiceFire* this, GlobalContext* globalCtx) { + s32 pad; + Vec3f velocity = { 0.0f, 0.0f, 0.0f }; + Vec3f accel = { 0.0f, 0.0f, 0.0f }; + Vec3f pos; + Color_RGBA8 primColor = { 255, 255, 0, 255 }; + Color_RGBA8 envColor = { 255, 0, 0, 255 }; + Vec3f sp84 = { 0.0f, 0.0f, 0.0f }; + Vec3f sp78 = { 0.0f, 0.0f, 0.0f }; + + this->actor.world.rot.z += 5000; + if (this->unk_15A == 0) { + this->unk_154 = 0.0f; + } + + Math_ApproachF(&this->scale, this->unk_154, 0.2f, 0.4f); + if ((this->unk_15A == 0) && (this->scale < 0.1f)) { + Actor_Kill(&this->actor); + } else if ((this->actor.params == 0) && (this->cylinder.base.atFlags & 4)) { + if (Player_HasMirrorShieldEquipped(globalCtx)) { + Audio_PlayActorSound2(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); + this->cylinder.base.atFlags &= 0xFFE9; + this->cylinder.base.atFlags |= 8; + this->cylinder.info.toucher.dmgFlags = 2; + this->unk_15A = 30; + this->actor.params = 1; + this->actor.velocity.x *= -1.0f; + this->actor.velocity.y *= -0.5f; + this->actor.velocity.z *= -1.0f; + } else { + this->unk_15A = 0; + EffectSsBomb2_SpawnLayered(globalCtx, &this->actor.world.pos, &sp78, &sp84, 10, 5); + this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_FIREBOMB); + this->actionFunc = func_809B2B48; + } + } else if (!(this->scale < .4f)) { + f32 scale = 1000.0f; + f32 life = 10.0f; + s32 i; + + for (i = 0; i < 10; i++) { + pos.x = this->actor.world.pos.x + (Rand_ZeroOne() - 0.5f) * (this->scale * 20.0f); + pos.y = this->actor.world.pos.y + (Rand_ZeroOne() - 0.5f) * (this->scale * 20.0f); + pos.z = this->actor.world.pos.z; + EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, scale, life); + } + Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_FIRE - SFX_FLAG); + } +} + +void func_809B2B48(EnAnubiceFire* this, GlobalContext* globalCtx) { + Vec3f velocity = { 0.0f, 0.0f, 0.0f }; + Vec3f accel = { 0.0f, 0.0f, 0.0f }; + Vec3f pos; + Color_RGBA8 primColor = { 255, 255, 0, 255 }; + Color_RGBA8 envColor = { 255, 0, 0, 255 }; + s32 pad; + s32 i; + + if (this->unk_15C == 0) { + for (i = 0; i < 20; i++) { + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y; + pos.z = this->actor.world.pos.z; + accel.x = Rand_CenteredFloat(8.0f); + accel.y = Rand_CenteredFloat(2.0f); + accel.z = Rand_CenteredFloat(8.0f); + EffectSsKiraKira_SpawnDispersed(globalCtx, &pos, &velocity, &accel, &primColor, &envColor, 2000, 10); + } + + this->unk_15C = 2; + this->unk_15E++; + if (this->unk_15E >= 6) { + Actor_Kill(&this->actor); + } + } +} + +void EnAnubiceFire_Update(Actor* thisx, GlobalContext* globalCtx) { + EnAnubiceFire* this = THIS; + s32 pad; + s32 i; + + Actor_SetScale(&this->actor, this->scale); + this->actionFunc(this, globalCtx); + func_8002D7EC(&this->actor); + this->unk_160[0] = this->actor.world.pos; + + for (i = 4; i >= 0; --i) { + this->unk_160[i + 1] = this->unk_160[i]; + } + + if (this->unk_15A != 0) { + this->unk_15A--; + } + + if (this->unk_15C != 0) { + this->unk_15C--; + } + + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 5.0f, 10.0f, 0x1D); + if (!(this->scale < 0.6f || this->actionFunc == func_809B2B48)) { + this->cylinder.dim.radius = this->scale * 15.0f + 5.0f; + this->cylinder.dim.height = this->scale * 15.0f + 5.0f; + this->cylinder.dim.yShift = this->scale * -0.75f + -15.0f; + + if (this->unk_15A != 0) { + Collider_UpdateCylinder(&this->actor, &this->cylinder); + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->cylinder.base); + } + + if (BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &this->actor.world.pos, 30.0f)) { + this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_ANUBIS_FIREBOMB); + this->actionFunc = func_809B2B48; + } + } +} + +static u64* D_809B3270[] = { gDust4Tex, gDust5Tex, gDust6Tex, gDust7Tex, gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex }; + +void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnAnubiceFire* this = THIS; + s32 pad[2]; + s32 i; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_anubice_fire.c", 503); + func_80093D84(globalCtx->state.gfxCtx); + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); + gDPPipeSync(POLY_XLU_DISP++); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809B3270[0])); + + Matrix_Push(); + for (i = this->unk_15E; i < 6; ++i) { + f32 scale = this->actor.scale.x - (i * 0.2f); + if (scale < 0.0f) { + scale = 0.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Anubice_Fire/func_809B26EC.s") + if (scale >= 0.1f) { + Matrix_Translate(this->unk_160[i].x, this->unk_160[i].y, this->unk_160[i].z, MTXMODE_NEW); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + func_800D1FD4(&globalCtx->mf_11DA0); + Matrix_RotateZ(this->actor.world.rot.z + i * 1000.0f, MTXMODE_APPLY); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Anubice_Fire/func_809B27D8.s") + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_anubice_fire.c", 546), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Anubice_Fire/func_809B2B48.s") + gSPDisplayList(POLY_XLU_DISP++, D_06003510); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Anubice_Fire/EnAnubiceFire_Update.s") + if (this->scale < 0.1f) { + break; + } + } + Matrix_Pull(); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Anubice_Fire/EnAnubiceFire_Draw.s") + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_anubice_fire.c", 556); +} diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h index cfc447ca6..c44bf6ff2 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.h @@ -6,9 +6,19 @@ struct EnAnubiceFire; +typedef void (*EnAnubiceFireActionFunc)(struct EnAnubiceFire*, GlobalContext*); + typedef struct EnAnubiceFire { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0xA8]; + /* 0x014C */ EnAnubiceFireActionFunc actionFunc; + /* 0x0150 */ f32 scale; + /* 0x0154 */ f32 unk_154; + /* 0x0158 */ s16 unused; + /* 0x015A */ s16 unk_15A; + /* 0x015C */ s16 unk_15C; + /* 0x015E */ s16 unk_15E; + /* 0x0178 */ Vec3f unk_160[6]; + /* 0x01A8 */ ColliderCylinder cylinder; } EnAnubiceFire; // size = 0x01F4 extern const ActorInit En_Anubice_Fire_InitVars; |
