From 8e3d28b536a8d7d8ea9d48793f6ad7525c986c8f Mon Sep 17 00:00:00 2001 From: Tom Overton Date: Sat, 19 Feb 2022 13:26:04 -0800 Subject: [PATCH] En_Syateki_Wf (Shooting Gallery Wolfos) OK (#673) * EnSyatekiWf_Init and EnSyatekiWf_Destroy OK * func_80A201CC OK * func_80A20284 OK * func_80A2030C and func_80A20320 OK * func_80A20378 OK * func_80A200E0 OK * func_80A203DC OK * func_80A20670 OK * func_80A206DC and func_80A20710 OK * func_80A2075C OK * func_80A2079C and func_80A20800 OK * func_80A208F8 OK * Import data to C * func_80A20858 OK * EnSyatekiWf_Update OK * Draw functions OK * Use generated reloc * Delete struct padding * Use object symbols * Name the statics * ANIMMODE enum * Misc cleanup * Format * Respond to review * Change do-while loops to just be while loops * Decimal counter --- include/functions.h | 2 +- spec | 3 +- .../ovl_En_Syateki_Wf/z_en_syateki_wf.c | 462 ++++++++++++++++-- .../ovl_En_Syateki_Wf/z_en_syateki_wf.h | 27 +- tools/disasm/functions.txt | 4 +- undefined_syms.txt | 5 - 6 files changed, 439 insertions(+), 64 deletions(-) diff --git a/include/functions.h b/include/functions.h index 2b42ce87ef..3a224a57d9 100644 --- a/include/functions.h +++ b/include/functions.h @@ -595,7 +595,7 @@ void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* // void EffectSsFireTail_SpawnFlameOnPlayer(void); void EffectSsEnFire_SpawnVec3f(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, s16 scale, s16 arg4, s16 flags, s16 bodyPart); // void EffectSsEnFire_SpawnVec3s(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); -// void EffectSsExtra_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); +void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scoreIdx); void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim, Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk); void func_800B3030(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s32 colorIndex); // void EffectSsDeadDd_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE1* param_5, UNK_TYPE1* param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE4 param_10); diff --git a/spec b/spec index 17a9ecc8dc..2935b24cb5 100644 --- a/spec +++ b/spec @@ -2659,8 +2659,7 @@ beginseg name "ovl_En_Syateki_Wf" compress include "build/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.o" - include "build/data/ovl_En_Syateki_Wf/ovl_En_Syateki_Wf.data.o" - include "build/data/ovl_En_Syateki_Wf/ovl_En_Syateki_Wf.reloc.o" + include "build/src/overlays/actors/ovl_En_Syateki_Wf/ovl_En_Syateki_Wf_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index 952861c835..6e53877a36 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -5,8 +5,10 @@ */ #include "z_en_syateki_wf.h" +#include "overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h" +#include "objects/object_wf/object_wf.h" -#define FLAGS 0x08000030 +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_8000000) #define THIS ((EnSyatekiWf*)thisx) @@ -15,43 +17,91 @@ void EnSyatekiWf_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnSyatekiWf_Update(Actor* thisx, GlobalContext* globalCtx); void EnSyatekiWf_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_80A201CC(EnSyatekiWf* this); void func_80A20284(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A2030C(EnSyatekiWf* this); void func_80A20320(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A20378(EnSyatekiWf* this); void func_80A203DC(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A20670(EnSyatekiWf* this); void func_80A206DC(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A20710(EnSyatekiWf* this); void func_80A2075C(EnSyatekiWf* this, GlobalContext* globalCtx); +void func_80A2079C(EnSyatekiWf* this); void func_80A20800(EnSyatekiWf* this, GlobalContext* globalCtx); void func_80A208F8(EnSyatekiWf* this, GlobalContext* globalCtx); -#if 0 -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A20E74 = { - { COLTYPE_HIT5, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, - { 40, 60, 0, { 0, 0, 0 } }, -}; - -// static ColliderJntSphElementInit sJntSphElementsInit[1] = { -static ColliderJntSphElementInit D_80A20E50[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 17, { { 800, 0, 0 }, 25 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_80A20EA0 = { - { COLTYPE_HIT5, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 1, D_80A20E50, // sJntSphElementsInit, +static ColliderCylinderInit sCylinderInit1 = { + { + COLTYPE_HIT5, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_NONE, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, + { 40, 60, 0, { 0, 0, 0 } }, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A20EB0 = { - { COLTYPE_HIT5, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_NONE, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_HIT5, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + 1, + sJntSphElementsInit, +}; + +static ColliderCylinderInit sCylinderInit2 = { + { + COLTYPE_HIT5, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_NONE, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 15, 20, -15, { 0, 0, 0 } }, }; +static Vec3f D_80A20EDC = { 0.0f, 20.0f, 0.0f }; + +static Vec3f D_80A20EE8 = { 0.0f, 0.0f, 0.0f }; + const ActorInit En_Syateki_Wf_InitVars = { ACTOR_EN_SYATEKI_WF, ACTORCAT_ENEMY, @@ -64,60 +114,372 @@ const ActorInit En_Syateki_Wf_InitVars = { (ActorFunc)EnSyatekiWf_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A20FBC[] = { +static AnimationInfo sAnimations[] = { + { &object_wf_Anim_00A3CC, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -1.0f }, + { &object_wf_Anim_005700, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + { &object_wf_Anim_005700, 1.0f, 0.0f, 4.0f, ANIMMODE_ONCE, 1.0f }, + { &object_wf_Anim_005700, 1.0f, 4.0f, 8.0f, ANIMMODE_ONCE, 1.0f }, + { &object_wf_Anim_004A90, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, + { &object_wf_Anim_009A50, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 8.0f }, + { &object_wf_Anim_0053D0, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, +}; + +static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -#endif +static Vec3f D_80A20FC4 = { 0.0f, 0.5f, 0.0f }; -extern ColliderCylinderInit D_80A20E74; -extern ColliderJntSphElementInit D_80A20E50[1]; -extern ColliderJntSphInit D_80A20EA0; -extern ColliderCylinderInit D_80A20EB0; -extern InitChainEntry D_80A20FBC[]; +static Vec3f D_80A20FD0 = { 1200.0f, 0.0f, 0.0f }; -extern UNK_TYPE D_0600A3CC; +static TexturePtr sEyeTextures[] = { + object_wf_Tex_007AA8, + object_wf_Tex_0082A8, + object_wf_Tex_0084A8, + object_wf_Tex_0082A8, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/EnSyatekiWf_Init.s") +void EnSyatekiWf_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnSyatekiWf* this = THIS; + Path* path; + EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; + s32 temp; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/EnSyatekiWf_Destroy.s") + path = syatekiMan->path; + while (path->unk2 != 2) { + path = &globalCtx->setupPathList[path->unk1]; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A200E0.s") + temp = 0; + while (temp < EN_SYATEKI_WF_GET_PARAM_FF00(&this->actor)) { + temp++; + path = &globalCtx->setupPathList[path->unk1]; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A201CC.s") + if (path == NULL) { + Actor_MarkForDeath(&this->actor); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A20284.s") + this->unk_2A0 = Lib_SegmentedToVirtual(path->points); + this->unk_2A4 = 1; + this->unk_2A6 = path->count; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A2030C.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + this->unk_29C = 0; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); + this->actor.focus.pos = this->actor.world.pos; + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + this->actor.colChkInfo.health = 2; + this->actor.colChkInfo.cylRadius = 50; + this->actor.colChkInfo.cylHeight = 100; + this->eyeIndex = 0; + this->unk_2AC = 10.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A20320.s") + Collider_InitCylinder(globalCtx, &this->unk_2B4); + Collider_SetCylinder(globalCtx, &this->unk_2B4, &this->actor, &sCylinderInit1); + Collider_InitCylinder(globalCtx, &this->unk_300); + Collider_SetCylinder(globalCtx, &this->unk_300, &this->actor, &sCylinderInit2); + Collider_InitJntSph(globalCtx, &this->unk_34C); + Collider_SetJntSph(globalCtx, &this->unk_34C, &this->actor, &sJntSphInit, &this->unk_36C); + this->unk_34C.elements->dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A20378.s") + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_wf_Skel_0095D0, &object_wf_Anim_00A3CC, this->jointTable, + this->morphTable, 22); + Actor_SetScale(&this->actor, 0.01f); + this->actor.hintId = 0x4C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A203DC.s") + func_80A201CC(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A20670.s") +void EnSyatekiWf_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnSyatekiWf* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A206DC.s") + Collider_DestroyCylinder(globalCtx, &this->unk_2B4); + Collider_DestroyCylinder(globalCtx, &this->unk_300); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A20710.s") +void func_80A200E0(EnSyatekiWf* this) { + Vec3f sp24; + s16 temp; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A2075C.s") + this->actor.world.pos.x = this->unk_2A0[0].x; + this->actor.world.pos.y = this->unk_2A0[0].y; + this->actor.world.pos.z = this->unk_2A0[0].z; + sp24.x = this->unk_2A0[this->unk_2A4].x; + sp24.y = this->unk_2A0[this->unk_2A4].y; + sp24.z = this->unk_2A0[this->unk_2A4].z; + temp = Math_Vec3f_Yaw(&this->actor.world.pos, &sp24); + this->actor.shape.rot.y = temp; + this->actor.world.rot.y = temp; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A2079C.s") +void func_80A201CC(EnSyatekiWf* this) { + EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A20800.s") + this->actor.speedXZ = 0.0f; + this->actor.world = this->actor.home; + this->actor.prevPos = this->actor.home.pos; + this->actor.shape.rot = this->actor.world.rot; + this->actor.colChkInfo.health = 2; + this->actor.draw = NULL; + this->unk_2A4 = 1; + this->unk_298 = 0; + syatekiMan->unk_276 &= ~(1 << EN_SYATEKI_WF_GET_PARAM_FF00(&this->actor)); + this->actionFunc = func_80A20284; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A20858.s") +void func_80A20284(EnSyatekiWf* this, GlobalContext* globalCtx) { + EnSyatekiMan* syatekiMan; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A208F8.s") + if (this->actor.parent != NULL) { + syatekiMan = (EnSyatekiMan*)this->actor.parent; + if ((syatekiMan->unk_26A == 1) && (this->unk_298 == 1)) { + func_80A200E0(this); + func_80A2030C(this); + } else if (syatekiMan->unk_276 & (1 << EN_SYATEKI_WF_GET_PARAM_FF00(&this->actor))) { + this->unk_298 = 1; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/EnSyatekiWf_Update.s") +void func_80A2030C(EnSyatekiWf* this) { + this->actionFunc = func_80A20320; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A20CF4.s") +void func_80A20320(EnSyatekiWf* this, GlobalContext* globalCtx) { + if (this->unk_29C >= 11) { + Actor_PlaySfxAtPos(this->actor.parent, NA_SE_EN_WOLFOS_APPEAR); + this->unk_29C = 0; + func_80A20378(this); + } else { + this->unk_29C++; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/func_80A20D10.s") +void func_80A20378(EnSyatekiWf* this) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); + this->actor.speedXZ = 10.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actor.draw = EnSyatekiWf_Draw; + this->actionFunc = func_80A203DC; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Syateki_Wf/EnSyatekiWf_Draw.s") +void func_80A203DC(EnSyatekiWf* this, GlobalContext* globalCtx) { + Vec3f sp54; + f32 sp50; + s16 temp_v0; + EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; + + if (syatekiMan->unk_26A != 1) { + func_80A201CC(this); + } + + sp54.x = this->unk_2A0[this->unk_2A4].x; + sp54.y = this->unk_2A0[this->unk_2A4].y; + sp54.z = this->unk_2A0[this->unk_2A4].z; + temp_v0 = (this->actor.wallYaw - this->actor.world.rot.y) + 0x8000; + + if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & 8) { + if ((ABS(temp_v0) < 0x1555) && (this->actor.wallPoly != this->actor.floorPoly)) { + func_80A20670(this); + return; + } + } + + if (this->actor.bgCheckFlags & 4) { + this->actor.velocity.y = 2.0f; + } + + sp50 = Math_Vec3f_DistXZ(&this->actor.world.pos, &sp54); + this->unk_2A8 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp54); + + if (sp50 > 15.0f) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2A8, 5, 0x3000, 0x100); + this->actor.shape.rot.y = this->actor.world.rot.y; + if (sp50 < 50.0f) { + if (this->actor.speedXZ > 3.0f) { + this->actor.speedXZ = this->actor.speedXZ - 0.5f; + } else { + this->actor.speedXZ = this->actor.speedXZ; + } + } + } else { + if (this->unk_2A4 < (this->unk_2A6 - 1)) { + if (this->unk_2A4 == EN_SYATEKI_WF_GET_PARAM_F0(&this->actor)) { + func_80A2079C(this); + } + + this->unk_2A4++; + } else { + this->unk_298 = 0; + this->unk_2A4 = 1; + func_80A201CC(this); + } + } + + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 10.0f, 3, 2.0f, 0, 0, 0); + } + } +} + +void func_80A20670(EnSyatekiWf* this) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_TEKU_JUMP); + this->actor.velocity.y = 20.0f; + this->actor.speedXZ = 5.0f; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + this->actionFunc = func_80A206DC; +} + +void func_80A206DC(EnSyatekiWf* this, GlobalContext* globalCtx) { + if (this->actor.bgCheckFlags & 2) { + func_80A20710(this); + } +} + +void func_80A20710(EnSyatekiWf* this) { + this->actor.speedXZ = 0.0f; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 3); + this->actionFunc = func_80A2075C; +} + +void func_80A2075C(EnSyatekiWf* this, GlobalContext* globalCtx) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + func_80A20378(this); + } +} + +void func_80A2079C(EnSyatekiWf* this) { + this->unk_29A = 40; + this->actor.speedXZ = 0.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_APPEAR); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + this->actionFunc = func_80A20800; +} + +void func_80A20800(EnSyatekiWf* this, GlobalContext* globalCtx) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + this->unk_29A--; + if (this->unk_29A == 0) { + func_80A20378(this); + } + } +} + +void func_80A20858(EnSyatekiWf* this, GlobalContext* globalCtx) { + EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; + + this->unk_298 = 0; + this->actor.speedXZ = 0.0f; + EffectSsExtra_Spawn(globalCtx, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 5, 2); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_WOLFOS_DEAD); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 6); + syatekiMan->unk_280 += 100; + this->actionFunc = func_80A208F8; +} + +void func_80A208F8(EnSyatekiWf* this, GlobalContext* globalCtx) { + s32 pad; + + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + func_80A201CC(this); + } else { + Vec3f sp68; + Vec3f sp5C = D_80A20FC4; + s32 i; + + for (i = (s32)this->skelAnime.animLength - (s32)this->skelAnime.curFrame; i >= 0; i--) { + sp68.x = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.x; + sp68.z = randPlusMinusPoint5Scaled(60.0f) + this->actor.world.pos.z; + sp68.y = randPlusMinusPoint5Scaled(50.0f) + (this->actor.world.pos.y + 20.0f); + func_800B3030(globalCtx, &sp68, &sp5C, &sp5C, 0x64, 0, 2); + } + } +} + +void EnSyatekiWf_Update(Actor* thisx, GlobalContext* globalCtx2) { + GlobalContext* globalCtx = globalCtx2; + EnSyatekiWf* this = THIS; + + if (this->actionFunc != func_80A20284) { + SkelAnime_Update(&this->skelAnime); + } + + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 32.0f, 30.0f, 60.0f, 5); + this->actionFunc(this, globalCtx); + + if (this->actor.bgCheckFlags & 3) { + func_800BE3D0(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); + } else { + Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x3E8, 0); + Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0x3E8, 0); + } + + if ((this->unk_2B4.base.acFlags & AC_HIT) || (this->unk_300.base.acFlags & AC_HIT) || + (this->unk_34C.base.acFlags & AC_HIT)) { + this->unk_2B4.base.acFlags &= ~AC_HIT; + this->unk_300.base.acFlags &= ~AC_HIT; + this->unk_34C.base.acFlags &= ~AC_HIT; + this->actor.colChkInfo.health -= 2; + if (this->actor.colChkInfo.health == 0) { + func_801A3098(NA_BGM_GET_ITEM | 0x900); + func_80A20858(this, globalCtx); + } else { + play_sound(NA_SE_SY_TRE_BOX_APPEAR); + EffectSsExtra_Spawn(globalCtx, &this->actor.world.pos, &D_80A20EDC, &D_80A20EE8, 3, 0); + } + } + + Collider_UpdateCylinder(&this->actor, &this->unk_2B4); + if ((this->actionFunc != func_80A20284) && (this->actionFunc != func_80A208F8) && (this->actor.draw != NULL)) { + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_300.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_2B4.base); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_34C.base); + this->actor.focus.pos = this->actor.world.pos; + this->actor.focus.pos.y += 25.0f; + } + + if (this->eyeIndex == 0) { + if ((Rand_ZeroOne() < 0.2f) && ((globalCtx->gameplayFrames & 3) == 0) && (this->actor.colorFilterTimer == 0)) { + this->eyeIndex++; + } + } else { + this->eyeIndex = (this->eyeIndex + 1) & 3; + } +} + +s32 EnSyatekiWf_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + return false; +} + +void EnSyatekiWf_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnSyatekiWf* this = THIS; + Vec3f sp18; + + Collider_UpdateSpheres(limbIndex, &this->unk_34C); + if (limbIndex == 6) { + Matrix_MultiplyVector3fByState(&D_80A20FD0, &sp18); + this->unk_300.dim.pos.x = sp18.x; + this->unk_300.dim.pos.y = sp18.y; + this->unk_300.dim.pos.z = sp18.z; + } +} + +void EnSyatekiWf_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnSyatekiWf* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex])); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnSyatekiWf_OverrideLimbDraw, EnSyatekiWf_PostLimbDraw, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h index ff552ed19c..23977fa021 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h @@ -3,15 +3,34 @@ #include "global.h" +#define EN_SYATEKI_WF_GET_PARAM_F0(thisx) (((thisx)->params & 0xF0) >> 4) +#define EN_SYATEKI_WF_GET_PARAM_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) + struct EnSyatekiWf; typedef void (*EnSyatekiWfActionFunc)(struct EnSyatekiWf*, GlobalContext*); typedef struct EnSyatekiWf { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x150]; - /* 0x0294 */ EnSyatekiWfActionFunc actionFunc; - /* 0x0298 */ char unk_298[0x134]; + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[22]; + /* 0x20C */ Vec3s morphTable[22]; + /* 0x290 */ UNK_TYPE1 unk_290[0x4]; + /* 0x294 */ EnSyatekiWfActionFunc actionFunc; + /* 0x298 */ s16 unk_298; + /* 0x29A */ s16 unk_29A; + /* 0x29C */ s16 unk_29C; + /* 0x2A0 */ Vec3s* unk_2A0; + /* 0x2A4 */ s16 unk_2A4; + /* 0x2A6 */ s16 unk_2A6; + /* 0x2A8 */ s16 unk_2A8; + /* 0x2AC */ f32 unk_2AC; + /* 0x2B0 */ u8 eyeIndex; + /* 0x2B4 */ ColliderCylinder unk_2B4; + /* 0x300 */ ColliderCylinder unk_300; + /* 0x34C */ ColliderJntSph unk_34C; + /* 0x36C */ ColliderJntSphElement unk_36C; + /* 0x3AC */ UNK_TYPE1 unk_3AC[0x20]; } EnSyatekiWf; // size = 0x3CC extern const ActorInit En_Syateki_Wf_InitVars; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 560e9ee241..8f47ab4117 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -9892,8 +9892,8 @@ 0x80A20858:("func_80A20858",), 0x80A208F8:("func_80A208F8",), 0x80A20A50:("EnSyatekiWf_Update",), - 0x80A20CF4:("func_80A20CF4",), - 0x80A20D10:("func_80A20D10",), + 0x80A20CF4:("EnSyatekiWf_OverrideLimbDraw",), + 0x80A20D10:("EnSyatekiWf_PostLimbDraw",), 0x80A20DA4:("EnSyatekiWf_Draw",), 0x80A21150:("func_80A21150",), 0x80A211F4:("func_80A211F4",), diff --git a/undefined_syms.txt b/undefined_syms.txt index 3615fb295b..74718ed449 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1841,11 +1841,6 @@ D_06003180 = 0x06003180; D_060033D0 = 0x060033D0; D_0600466C = 0x0600466C; -// ovl_En_Syateki_Wf - -D_060095D0 = 0x060095D0; -D_0600A3CC = 0x0600A3CC; - // ovl_En_S_Goro D_060091A8 = 0x060091A8;