diff --git a/include/functions.h b/include/functions.h index 4af08dd4f6..acb600d7fd 100644 --- a/include/functions.h +++ b/include/functions.h @@ -522,7 +522,7 @@ s32 func_800A8150(s32 index); s32 func_800A817C(s32 index); s32 func_800A81A4(GlobalContext* globalCtx, s32 a1, s32 a2); void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2); -// void func_800A8514(void); +void func_800A8514(void* effectParams); void EffectBlure_Initcommon(EffectBlure* params); void EffectBlure_Init1(EffectBlure* params, EffBlureInit1* init); void EffectBlure_Init2(EffectBlure* params, EffBlureInit2* init); @@ -635,7 +635,8 @@ void EffectSsKiraKira_SpawnDispersed (GlobalContext * globalCtx, Vec3f * pos, Ve // void EffectSsGSpk_SpawnFuse(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void EffectSsGSpk_SpawnRandColor(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7); // void EffectSsGSpk_SpawnSmall(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -// void EffectSsDFire_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE2 param_6, UNK_TYPE2 param_7, UNK_TYPE2 param_8, UNK_TYPE2 param_9, UNK_TYPE4 param_10); +void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, + s16 alpha, s16 fadeDelay, s16 arg8, s32 life); void EffectSsBubble_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 yPosOffset, f32 yPosRandScale, f32 xzPosRandScale, f32 scale); void EffectSsGRipple_Spawn(GlobalContext* globalCtx, Vec3f* pos, s16 radius, s16 radiusMax, s16 life); @@ -888,10 +889,10 @@ void func_800BC154(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* acto // void func_800BC188(void); // void func_800BC1B4(void); Actor* func_800BC270(GlobalContext* globalCtx, Actor* actor, f32 arg2, UNK_TYPE4 arg3); -// void func_800BC444(void); +Actor* func_800BC444(GlobalContext* globalCtx, Actor* actor, f32 arg2); // void func_800BC4EC(void); // void func_800BC5B8(void); -// void func_800BC5EC(void); +s32 func_800BC5EC(GlobalContext* globalCtx, Actor* actor); void func_800BC620(Vec3f* arg0, Vec3f* arg1, UNK_TYPE arg2, GlobalContext* globalCtx); // void func_800BC770(void); // void func_800BC7D8(void); @@ -919,12 +920,12 @@ void func_800BE03C(GlobalContext* globalCtx, Gfx* dl); // void func_800BE184(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); u8 func_800BE22C(Actor* actor); void func_800BE258(Actor* actor, UNK_PTR arg1); -// void func_800BE2B8(void); -// void func_800BE33C(void); +void func_800BE2B8(Actor* actor, ColliderJntSph* jntSphere); +void func_800BE33C(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, s32 arg3); // void func_800BE3D0(void); void func_800BE504(Actor* actor, ColliderCylinder* collider); // void func_800BE568(void); -void func_800BE5CC(Actor* actor, ColliderJntSph* collider, UNK_TYPE1 arg2); +void func_800BE5CC(Actor* actor, ColliderJntSph* collider, s32 arg2); // void func_800BE63C(void); void func_800BE680(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos[], s32 arg3, f32 arg4, f32 arg5, f32 arg6, u8 mode); void func_800BF7CC(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos[], s32 arg3, s32 arg4, f32 arg5, f32 arg6); diff --git a/include/z64math.h b/include/z64math.h index c458cf24ee..3caad91083 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -106,6 +106,7 @@ typedef struct { #define DEGF_TO_RADF(degf) (degf * (M_PI / 180.0f)) #define BINANG_ROT180(angle) ((s16)(angle + 0x8000)) #define BINANG_SUB(a, b) ((s16)(a - b)) +#define BINANG_ADD(a, b) ((s16)(a + b)) #define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f)) #define BINANG_TO_DEGF(binang) ((f32)binang * (360.0001525f / 65535.0f)) #define BINANG_TO_RAD(binang) (((f32)binang / 32768.0f) * M_PI) diff --git a/spec b/spec index 97af0e7f5a..3dbf784541 100644 --- a/spec +++ b/spec @@ -926,8 +926,7 @@ beginseg name "ovl_En_Dinofos" compress include "build/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.o" - include "build/data/ovl_En_Dinofos/ovl_En_Dinofos.data.o" - include "build/data/ovl_En_Dinofos/ovl_En_Dinofos.reloc.o" + include "build/src/overlays/actors/ovl_En_Dinofos/ovl_En_Dinofos_reloc.o" endseg beginseg diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index f9abd023b5..51b382c880 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -402,9 +402,8 @@ void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, } // EffectSsDFire Spawn Functions -#ifdef NON_MATCHING void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, - s16 alpha, s16 fadeDelay, s16 life) { + s16 alpha, s16 fadeDelay, s16 life, s32 arg9) { EffectSsDFireInitParams initParams; Math_Vec3f_Copy(&initParams.pos, pos); @@ -415,12 +414,10 @@ void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, initParams.alpha = alpha; initParams.fadeDelay = fadeDelay; initParams.life = life; + initParams.unk_30 = arg9; EffectSs_Spawn(globalCtx, EFFECT_SS_D_FIRE, 128, &initParams); } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/EffectSsDFire_Spawn.s") -#endif // EffectSsBubble Spawn Functions diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 98bca8ae9d..baf690fab4 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -1,3 +1,9 @@ +/* + * File: z_en_dinofos.c + * Overlay: ovl_En_Dinofos + * Description: Dinolfos + */ + #include "z_en_dinofos.h" #define FLAGS 0x00000435 @@ -9,27 +15,66 @@ void EnDinofos_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnDinofos_Update(Actor* thisx, GlobalContext* globalCtx); void EnDinofos_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_8089B834(EnDinofos* this, GlobalContext* globalCtx); +void func_8089D318(EnDinofos* this, GlobalContext* globalCtx); +void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx); +void func_8089B8B0(EnDinofos* this, GlobalContext* globalCtx); +void func_8089C56C(EnDinofos* this, GlobalContext* globalCtx); +void func_8089C44C(EnDinofos* this, GlobalContext* globalCtx); +void func_8089BB60(EnDinofos* this, GlobalContext* globalCtx); +void func_8089C0DC(EnDinofos* this, GlobalContext* globalCtx); +void func_8089D018(EnDinofos* this, GlobalContext* globalCtx); void func_8089B288(EnDinofos* this, GlobalContext* globalCtx); +void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx); +void func_8089D1E0(EnDinofos* this, GlobalContext* globalCtx); +void func_8089B98C(EnDinofos* this, GlobalContext* globalCtx); +void func_8089CA74(EnDinofos* this, GlobalContext* globalCtx); void func_8089B3D4(EnDinofos* this, GlobalContext* globalCtx); +void func_8089CB10(EnDinofos* this, GlobalContext* globalCtx); +void func_8089CBEC(EnDinofos* this, GlobalContext* globalCtx); +void func_8089CF00(EnDinofos* this, GlobalContext* globalCtx); +void func_8089CF70(EnDinofos* this, GlobalContext* globalCtx); void func_8089B580(EnDinofos* this, GlobalContext* globalCtx); void func_8089B72C(EnDinofos* this, GlobalContext* globalCtx); -void func_8089B834(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C0DC(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C1F8(EnDinofos* this, GlobalContext* globalCtx); void func_8089C2A8(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C44C(EnDinofos* this, GlobalContext* globalCtx); -void func_8089C56C(EnDinofos* this, GlobalContext* globalCtx); +void func_8089C1F8(EnDinofos* this, GlobalContext* globalCtx); void func_8089C724(EnDinofos* this, GlobalContext* globalCtx); void func_8089C7B8(EnDinofos* this, GlobalContext* globalCtx); void func_8089C938(EnDinofos* this, GlobalContext* globalCtx); -void func_8089CA74(EnDinofos* this, GlobalContext* globalCtx); -void func_8089CBEC(EnDinofos* this, GlobalContext* globalCtx); -void func_8089CF70(EnDinofos* this, GlobalContext* globalCtx); -void func_8089D018(EnDinofos* this, GlobalContext* globalCtx); -void func_8089D1E0(EnDinofos* this, GlobalContext* globalCtx); -void func_8089D318(EnDinofos* this, GlobalContext* globalCtx); +void func_8089C4F8(EnDinofos* this); +void func_8089BAC0(EnDinofos* this); +void func_8089C024(EnDinofos* this, s32 arg1); +void func_8089D11C(EnDinofos* this, s16 arg1); +void func_8089B7B0(EnDinofos* this); +void func_8089D2E0(EnDinofos* this); +void func_8089CA14(EnDinofos* this); +void func_8089B320(EnDinofos* this); +void func_8089B4A4(EnDinofos* this); +void func_8089B6E8(EnDinofos* this); +void func_8089CFAC(EnDinofos* this); +void func_8089C398(EnDinofos* this); +void func_8089C164(EnDinofos* this); +void func_8089C244(EnDinofos* this); + +extern FlexSkeletonHeader D_06009570; +extern AnimationHeader D_06002E40; +extern AnimationHeader D_060025B4; +extern AnimationHeader D_06000580; +extern AnimationHeader D_06001CCC; +extern AnimationHeader D_0600ABD0; +extern AnimationHeader D_0600D62C; +extern AnimationHeader D_06001040; +extern AnimationHeader D_060013C0; +extern AnimationHeader D_060017B8; +extern AnimationHeader D_0600C974; +extern AnimationHeader D_06009B70; +extern AnimationHeader D_06000AF0; +extern AnimationHeader D_0600D21C; +extern Gfx D_06008E30[]; +extern Gfx D_06009030[]; +extern Gfx D_06009230[]; +extern Gfx D_06009030[]; -#if 0 const ActorInit En_Dinofos_InitVars = { ACTOR_EN_DINOFOS, ACTORCAT_ENEMY, @@ -42,61 +87,142 @@ const ActorInit En_Dinofos_InitVars = { (ActorFunc)EnDinofos_Draw, }; -// static ColliderJntSphElementInit sJntSphElementsInit[9] = { -static ColliderJntSphElementInit D_8089E170[9] = { +static ColliderJntSphElementInit sJntSphElementsInit[9] = { { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 1, { { 200, 300, 0 }, 19 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 8, { { 200, 200, 0 }, 17 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 16, { { 600, 200, 0 }, 15 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 15, { { 700, 100, 0 }, 10 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 2, { { 1300, 100, 0 }, 12 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON | BUMP_HOOKABLE, + OCELEM_ON, + }, { 5, { { 1300, 100, 0 }, 12 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x20000000, 0x09, 0x08 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x20000000, 0x09, 0x08 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 21, { { 0, -10, 35 }, 20 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x20000000, 0x09, 0x08 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x20000000, 0x09, 0x08 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 21, { { 0, -10, 70 }, 28 }, 100 }, }, { - { ELEMTYPE_UNK0, { 0x20000000, 0x09, 0x08 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, }, + { + ELEMTYPE_UNK0, + { 0x20000000, 0x09, 0x08 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_NONE, + }, { 21, { { 0, -5, 110 }, 30 }, 100 }, }, }; -// static ColliderJntSphInit sJntSphInit = { -static ColliderJntSphInit D_8089E2B4 = { - { COLTYPE_HIT0, AT_NONE | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 9, D_8089E170, // sJntSphElementsInit, +static ColliderJntSphInit sJntSphInit = { + { + COLTYPE_HIT0, + AT_NONE | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, + }, + 9, + sJntSphElementsInit, }; -// static ColliderQuadInit sQuadInit = { -static ColliderQuadInit D_8089E2C4 = { - { COLTYPE_NONE, AT_NONE | AT_TYPE_ENEMY, AC_NONE, OC1_NONE, OC2_NONE, COLSHAPE_QUAD, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x04 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, BUMP_NONE, OCELEM_NONE, }, +static ColliderQuadInit sQuadInit = { + { + COLTYPE_NONE, + AT_NONE | AT_TYPE_ENEMY, + AC_NONE, + OC1_NONE, + OC2_NONE, + COLSHAPE_QUAD, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x04 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_NORMAL | TOUCH_UNK7, + BUMP_NONE, + OCELEM_NONE, + }, { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -// static DamageTable sDamageTable = { -static DamageTable D_8089E314 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x1), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -131,156 +257,1263 @@ static DamageTable D_8089E314 = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -// sColChkInfoInit -static CollisionCheckInfoInit D_8089E334 = { 4, 40, 100, 80 }; +static CollisionCheckInfoInit sColChkInfoInit = { 4, 40, 100, 80 }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_8089E354[] = { +static Gfx* D_8089E33C[] = { + D_06008E30, + D_06009030, + D_06009230, + D_06009030, +}; + +static s16 D_8089E34C = -1; +static s32 D_8089E350 = 0; + +static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_S8(hintId, 16, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_STOP), }; -#endif +void EnDinofos_Init(Actor* thisx, GlobalContext* globalCtx) { + static s32 D_8089E364 = 0; + static EffBlureInit2 D_8089E368 = { + { 0, 0, 0, 0, 0, 8, 0, 0 }, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, + { 255, 255, 255, 0 }, { 255, 255, 255, 0 }, { 8, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + }; -extern ColliderJntSphElementInit D_8089E170[9]; -extern ColliderJntSphInit D_8089E2B4; -extern ColliderQuadInit D_8089E2C4; -extern DamageTable D_8089E314; -extern CollisionCheckInfoInit D_8089E334; -extern InitChainEntry D_8089E354[]; + EnDinofos* this = THIS; + s32 i; + ColliderJntSphElementDim* dim; -extern UNK_TYPE D_06000580; -extern UNK_TYPE D_06000AF0; -extern UNK_TYPE D_06001040; -extern UNK_TYPE D_060013C0; -extern UNK_TYPE D_060017B8; -extern UNK_TYPE D_06001CCC; -extern UNK_TYPE D_060025B4; -extern UNK_TYPE D_06002E40; -extern UNK_TYPE D_06009B70; -extern UNK_TYPE D_0600ABD0; -extern UNK_TYPE D_0600C974; -extern UNK_TYPE D_0600D21C; -extern UNK_TYPE D_0600D62C; + Actor_ProcessInitChain(&this->actor, sInitChain); + ActorShape_Init(&this->actor.shape, 0.0f, func_800B42F8, 90.0f); + Effect_Add(globalCtx, &this->unk_2A0, 2, 0, 0, &D_8089E368); + Collider_InitAndSetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, + this->colliderJntSphElement); + Collider_InitAndSetQuad(globalCtx, &this->colliderQuad, &this->actor, &sQuadInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06009570, &D_06002E40, this->jointTable, this->morphTable, 21); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/EnDinofos_Init.s") + if (D_8089E364 == 0) { + for (i = 0; i < ARRAY_COUNT(D_8089E33C); i++) { + D_8089E33C[i] = (Gfx*)Lib_SegmentedToVirtual(D_8089E33C[i]); + } + D_8089E364 = 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/EnDinofos_Destroy.s") + this->unk_288 = 255; + for (i = 6; i < ARRAY_COUNT(this->colliderJntSphElement); i++) { + dim = &this->colliderJntSph.elements[i].dim; + dim->worldSphere.radius = dim->modelSphere.radius; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089A900.s") + this->unk_28B = 0; + if (thisx->cutscene == -1) { + func_8089B7B0(this); + } else { + this->actor.flags |= 0x100000; + this->actor.gravity = 0.0f; + this->actor.velocity.y = 0.0f; + D_8089E34C = thisx->cutscene; + func_8089D2E0(this); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089A968.s") + D_8089E350++; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089A9B0.s") +void EnDinofos_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnDinofos* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089ABF4.s") + Effect_Destroy(globalCtx, this->unk_2A0); + Collider_DestroyJntSph(globalCtx, &this->colliderJntSph); + Collider_DestroyQuad(globalCtx, &this->colliderQuad); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089AC70.s") +void func_8089A900(EnDinofos* this) { + if (this->unk_289 != 0) { + this->unk_289++; + if (this->unk_289 == 4) { + this->unk_289 = 0; + } + } else if (Rand_ZeroOne() < 0.05f) { + this->unk_289 = 1; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089ACEC.s") +s32 func_8089A968(EnDinofos* this) { + s16 temp_v0 = (this->actor.yawTowardsPlayer - this->unk_28E) - this->actor.shape.rot.y; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089AD70.s") + if (ABS_ALT(temp_v0) < 0x3000) { + return true; + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089AE00.s") +void func_8089A9B0(EnDinofos* this, GlobalContext* globalCtx) { + if (func_8089A968(this)) { + if (this->actor.xzDistToPlayer < 100.0f) { + if (!func_800BC5EC(globalCtx, &this->actor) && + (((this->actionFunc != func_8089C56C) && (Rand_ZeroOne() > 0.35f)) || + ((this->actionFunc == func_8089C56C) && (Rand_ZeroOne() > 0.8f)))) { + func_8089C4F8(this); + } else { + func_8089BBB4(this, globalCtx); + } + } else if ((this->actor.xzDistToPlayer < 260.0f) && (this->actor.xzDistToPlayer > 180.0f)) { + if (((this->actionFunc != func_8089C44C) && (Rand_ZeroOne() < 0.1f)) || + ((this->actionFunc == func_8089C44C) && (Rand_ZeroOne() < 0.05f))) { + func_8089C024(this, 0); + } else { + func_8089BBB4(this, globalCtx); + } + } else if (Rand_ZeroOne() < 0.8f) { + func_8089B8B0(this, globalCtx); + } else { + func_8089BBB4(this, globalCtx); + } + } else if (Rand_ZeroOne() < 0.6f) { + func_8089BAC0(this); + } else { + func_8089B7B0(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B100.s") +void func_8089ABF4(EnDinofos* this, GlobalContext* globalCtx) { + if (this->camId != 0) { + Camera* camera = Play_GetCamera(globalCtx, this->camId); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B288.s") + func_8016970C(globalCtx, 0, &camera->at, &camera->eye); + this->camId = 0; + ActorCutscene_Stop(this->actor.cutscene); + if (this->actor.colChkInfo.health == 0) { + func_800B724C(globalCtx, &this->actor, 6); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B320.s") +void func_8089AC70(EnDinofos* this) { + this->unk_28A = 10; + this->unk_2B4 = 0.55f; + this->colliderJntSph.base.colType = COLTYPE_HIT3; + this->unk_2B8 = 0.82500005f; + this->unk_2B0 = 1.0f; + this->unk_290 = 80; + this->actor.flags &= ~0x400; + func_800BCB70(&this->actor, 0x4000, 255, 0, 80); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B3D4.s") +void func_8089ACEC(EnDinofos* this, GlobalContext* globalCtx) { + if (this->unk_28A == 10) { + this->unk_28A = 0; + this->colliderJntSph.base.colType = COLTYPE_HIT0; + this->unk_2B0 = 0.0f; + func_800BF7CC(globalCtx, &this->actor, this->unk_2D4, 12, 2, 0.3f, 0.2f); + this->actor.flags |= 0x400; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B4A4.s") +void func_8089AD70(EnDinofos* this) { + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B580.s") + if (this->unk_28B != 0) { + for (i = 0; i < ARRAY_COUNT(this->colliderJntSphElement) - 3; i++) { + this->colliderJntSph.elements[i].info.bumper.dmgFlags |= 0x400; + } + this->unk_28B = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B6E8.s") +s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + s16 temp_v1; + s16 temp_v1_2; + Actor* temp_v0; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B72C.s") + temp_v0 = func_800BC270(globalCtx, &this->actor, 80.0f, 0x138B0); + if (temp_v0 != NULL) { + temp_v1 = (Actor_YawBetweenActors(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; + if (ABS_ALT(temp_v1) < 0x3000) { + func_8089D11C(this, temp_v1 + this->unk_28E); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WARAU); + return true; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B7B0.s") + temp_v0 = func_800BC444(globalCtx, &this->actor, 80.0f); + if ((temp_v0 != NULL) && (temp_v0->id == ACTOR_EN_BOM_CHU)) { + temp_v1_2 = (Actor_YawBetweenActors(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; + if (ABS_ALT(temp_v1_2) < 0x3000) { + func_8089C024(this, 1); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WARAU); + return true; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B834.s") + if (globalCtx->actorCtx.unk2 != 0) { + func_8089C024(this, 1); + return true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B8B0.s") + if ((this->actor.xzDistToPlayer < 100.0f) && (player->swordState != 0) && this->actor.isTargeted && + (Rand_ZeroOne() < 0.5f) && func_8089A968(this) && Actor_IsLinkFacingActor(&this->actor, 0x2000, globalCtx)) { + if (Rand_ZeroOne() < 0.5f) { + func_8089C024(this, 2); + } else { + func_8089C024(this, 3); + } + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WARAU); + return true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089B98C.s") + if ((gSaveContext.playerForm == PLAYER_FORM_GORON) && (player->actor.velocity.y < -5.0f) && + (player->unk_AE7 == 1) && (this->unk_28B == 0)) { + this->unk_28B = 1; + for (i = 0; i < ARRAY_COUNT(this->colliderJntSphElement) - 3; i++) { + this->colliderJntSph.elements[i].info.bumper.dmgFlags &= ~0x400; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089BAC0.s") + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089BB60.s") +void func_8089B100(EnDinofos* this, GlobalContext* globalCtx) { + Camera* camera = Play_GetCamera(globalCtx, this->camId); + Player* player = PLAYER; + Vec3f sp3C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089BBB4.s") + SkelAnime_ChangeAnim(&this->skelAnime, &D_06001CCC, 1.0f, SkelAnime_GetFrameCount(&D_06001CCC.common), + SkelAnime_GetFrameCount(&D_06001CCC.common), 2, 0.0f); + func_800BE33C(&camera->eye, &camera->at, &this->unk_29A, 1); + Math_Vec3f_Diff(&this->actor.world.pos, &player->actor.world.pos, &sp3C); + this->unk_2BC.x = player->actor.world.pos.x + (0.4f * sp3C.x); + this->unk_2BC.y = player->actor.world.pos.y + 5.0f; + this->unk_2BC.z = player->actor.world.pos.z + (0.4f * sp3C.z); + this->unk_2C8.x = this->actor.world.pos.x; + this->unk_2C8.y = this->actor.focus.pos.y - 400.0f; + this->unk_2C8.z = this->actor.world.pos.z; + this->unk_2AC = Math_Vec3f_DistXYZ(&camera->eye, &this->unk_2BC) * 0.05f; + this->unk_2A8 = Math_Vec3f_DistXYZ(&camera->at, &this->unk_2C8) * 0.05f; + this->unk_290 = 20; + this->actionFunc = func_8089B288; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089BD28.s") +void func_8089B288(EnDinofos* this, GlobalContext* globalCtx) { + Camera* camera = Play_GetCamera(globalCtx, this->camId); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C024.s") + this->unk_290--; + Math_Vec3f_StepTo(&camera->eye, &this->unk_2BC, this->unk_2AC); + Math_Vec3f_StepTo(&camera->at, &this->unk_2C8, this->unk_2A8); + func_8016970C(globalCtx, this->camId, &camera->at, &camera->eye); + if (this->unk_290 == 0) { + func_8089B320(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C0DC.s") +void func_8089B320(EnDinofos* this) { + this->actor.gravity = -2.0f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); + this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y - 0x0E00) * 86.0f) + this->actor.world.pos.x; + this->unk_2BC.y = this->actor.floorHeight + 6.0f; + this->unk_2BC.z = (Math_CosS(this->actor.shape.rot.y - 0x0E00) * 86.0f) + this->actor.world.pos.z; + this->unk_290 = 0; + this->actionFunc = func_8089B3D4; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C164.s") +void func_8089B3D4(EnDinofos* this, GlobalContext* globalCtx) { + Camera* camera = Play_GetCamera(globalCtx, this->camId); + Vec3f sp28; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C1F8.s") + Math_Vec3f_StepTo(&camera->eye, &this->unk_2BC, 10.0f); + this->unk_290++; + if (this->unk_290 == 10) { + func_801A2E54(0x38); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C244.s") + sp28.x = this->actor.world.pos.x; + sp28.z = this->actor.world.pos.z; + if (this->actor.focus.pos.y <= camera->at.y) { + sp28.y = this->actor.focus.pos.y; + } else { + sp28.y = camera->at.y; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C2A8.s") + func_8016970C(globalCtx, this->camId, &sp28, &camera->eye); + if (this->actor.bgCheckFlags & 1) { + func_8089B4A4(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C398.s") +void func_8089B4A4(EnDinofos* this) { + if (this->unk_290 < 10) { + func_801A2E54(0x38); + } + SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600C974); + this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.x; + this->unk_2BC.y = this->actor.floorHeight + 11.0f; + this->unk_2BC.z = (Math_CosS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.z; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_BOMCHU_WALK); + this->unk_290 = 0; + this->unk_292 = -1; + this->actionFunc = func_8089B580; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C44C.s") +void func_8089B580(EnDinofos* this, GlobalContext* globalCtx) { + Camera* camera = Play_GetCamera(globalCtx, this->camId); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C4F8.s") + this->unk_290++; + if (this->unk_290 < 8) { + func_8016970C(globalCtx, this->camId, &this->actor.focus.pos, &camera->eye); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C56C.s") + if (this->skelAnime.animCurrentFrame > 35.0f) { + if ((globalCtx->sceneNum == SCENE_MITURIN) && func_801378B8(&this->skelAnime, 38.0f)) { + globalCtx->envCtx.unk_C3 = 11; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C690.s") + Math_Vec3f_StepTo(&camera->eye, &this->unk_2BC, 10.0f); + func_8016970C(globalCtx, this->camId, &this->actor.focus.pos, &camera->eye); + if (this->skelAnime.animCurrentFrame <= 55.0f) { + func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C724.s") + if ((globalCtx->sceneNum == SCENE_MITURIN) && func_801378B8(&this->skelAnime, 55.0f)) { + globalCtx->envCtx.unk_C3 = 0xFF; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C784.s") + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + func_8089B6E8(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C7B8.s") +void func_8089B6E8(EnDinofos* this) { + SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06009B70, -3.0f); + this->actionFunc = func_8089B72C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C87C.s") +void func_8089B72C(EnDinofos* this, GlobalContext* globalCtx) { + if (func_801378B8(&this->skelAnime, 2.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_ATTACK); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089C938.s") + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + func_8089ABF4(this, globalCtx); + this->actor.flags &= ~0x00100000; + this->actor.cutscene = -1; + func_8089B7B0(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089CA14.s") +void func_8089B7B0(EnDinofos* this) { + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06002E40, -4.0f); + this->unk_290 = (s32)Rand_ZeroFloat(20.0f) + 40; + this->unk_292 = 30; + this->actor.speedXZ = 0.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + func_8089AD70(this); + this->actionFunc = func_8089B834; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089CA74.s") +void func_8089B834(EnDinofos* this, GlobalContext* globalCtx) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (this->unk_292 != 0) { + this->unk_292--; + } else if (func_8089A968(this)) { + this->unk_290 = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089CB10.s") + if (this->unk_290 != 0) { + this->unk_290--; + } else { + func_8089A9B0(this, globalCtx); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089CBEC.s") +void func_8089B8B0(EnDinofos* this, GlobalContext* globalCtx) { + f32 phi_f0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089CF00.s") + if (this->actionFunc != func_8089B98C) { + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000580, -4.0f); + if (func_800BC5EC(globalCtx, &this->actor)) { + phi_f0 = 170.0f; + } else { + phi_f0 = 70.0f; + } + if (this->actor.xzDistToPlayer <= phi_f0) { + this->actor.speedXZ = -3.5f; + } else { + this->actor.speedXZ = 3.5f; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089CF70.s") + this->unk_292 = (s32)Rand_ZeroFloat(10.0f) + 20; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = func_8089B98C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089CFAC.s") +void func_8089B98C(EnDinofos* this, GlobalContext* globalCtx) { + f32 phi_f0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089D018.s") + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (!func_8089AE00(this, globalCtx)) { + if (func_800BC5EC(globalCtx, &this->actor)) { + phi_f0 = 170.0f; + } else { + phi_f0 = 70.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089D11C.s") + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); + this->actor.world.rot.y = this->actor.shape.rot.y; + if (this->actor.xzDistToPlayer <= phi_f0) { + Math_StepToF(&this->actor.speedXZ, -7.0f, 0.5f); + } else { + Math_StepToF(&this->actor.speedXZ, 7.0f, 0.5f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089D1E0.s") + if (this->actor.xzDistToPlayer < 80.0f) { + this->unk_292 = 0; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089D2E0.s") + if (this->unk_292 != 0) { + this->unk_292--; + } else { + func_8089A9B0(this, globalCtx); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089D318.s") + if (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 6.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089D42C.s") +void func_8089BAC0(EnDinofos* this) { + if (this->actionFunc != func_8089BB60) { + SkelAnime_ChangeAnimTransitionRepeat(&this->skelAnime, &D_06000580, -4.0f); + this->actor.speedXZ = 0.0f; + } + if (BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y) > 0) { + this->unk_28C = BINANG_ADD(this->actor.shape.rot.y, 0x4000); + } else { + this->unk_28C = BINANG_SUB(this->actor.shape.rot.y, 0x4000); + } + this->actor.world.rot.y = this->actor.shape.rot.y; + func_8089AD70(this); + this->actionFunc = func_8089BB60; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089D60C.s") +void func_8089BB60(EnDinofos* this, GlobalContext* globalCtx) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_28C, 0x400)) { + func_8089A9B0(this, globalCtx); + } + this->actor.world.rot.y = this->actor.shape.rot.y; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/EnDinofos_Update.s") +void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx) { + Player* player = PLAYER; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089DC4C.s") + if (this->actionFunc != func_8089BD28) { + s16 rotY = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (ABS_ALT(rotY) > 0x7800) { + if (Rand_ZeroOne() < 0.5f) { + this->actor.speedXZ = 6.0f; + } else { + this->actor.speedXZ = -6.0f; + } + } else if (rotY >= 0) { + this->actor.speedXZ = 6.0f; + } else { + this->actor.speedXZ = -6.0f; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/func_8089DC84.s") + if (this->actionFunc == func_8089D1E0) { + this->skelAnime.animPlaybackSpeed = this->actor.speedXZ * 0.166666671634f; + } else { + SkelAnime_ChangeAnim(&this->skelAnime, &D_0600D62C, this->actor.speedXZ * 0.166666671634f, 0.0f, 0.0f, 0, + -4.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Dinofos/EnDinofos_Draw.s") + this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); + this->unk_2A4 = 0; + this->unk_292 = (s32)Rand_ZeroFloat(10.0f) + 5; + } + + this->actionFunc = func_8089BD28; +} + +void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + s16 phi_v0; + f32 sp2C = 0.0f; + + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xBB8); + if (!func_8089AE00(this, globalCtx)) { + if (this->actor.bgCheckFlags & 8) { + if (this->actor.speedXZ >= 0.0f) { + phi_v0 = BINANG_ADD(this->actor.shape.rot.y, 0x4000); + } else { + phi_v0 = BINANG_SUB(this->actor.shape.rot.y, 0x4000); + } + + phi_v0 = this->actor.wallYaw - phi_v0; + if (ABS_ALT(phi_v0) > 0x4000) { + this->actor.speedXZ *= -0.8f; + if (this->actor.speedXZ < 0.0f) { + this->actor.speedXZ -= 0.5f; + } else { + this->actor.speedXZ += 0.5f; + } + } + } + + phi_v0 = BINANG_SUB(player->actor.shape.rot.y, this->actor.shape.rot.y); + if ((phi_v0 >= 0) && (phi_v0 < 0x7800)) { + this->actor.speedXZ += 0.125f; + } else if ((phi_v0 < 0) && (phi_v0 > -0x7800)) { + this->actor.speedXZ -= 0.125f; + } + + if (this->actor.speedXZ > 0.0f) { + this->skelAnime.animPlaybackSpeed = 1.0f; + } else { + this->skelAnime.animPlaybackSpeed = -1.0f; + } + + this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); + if (func_800BC5EC(globalCtx, &this->actor)) { + sp2C = 100.0f; + } + + if (this->actor.xzDistToPlayer <= (70.0f + sp2C)) { + Math_StepToF(&this->unk_2A4, -4.0f, 1.5f); + } else if ((90.0f + sp2C) < this->actor.xzDistToPlayer) { + Math_StepToF(&this->unk_2A4, 4.0f, 1.5f); + } else { + Math_StepToF(&this->unk_2A4, 0.0f, 5.65f); + } + + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_2A4; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_2A4; + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (this->unk_292 != 0) { + this->unk_292--; + } else { + func_8089A9B0(this, globalCtx); + } + + if (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 5.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); + } + } +} + +void func_8089C024(EnDinofos* this, s32 arg1) { + if (arg1 == 0) { + SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001CCC, 2.0f); + func_8089AD70(this); + } else { + SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001CCC, -1.0f); + if ((arg1 == 2) || (arg1 == 3)) { + this->colliderJntSph.base.acFlags &= ~AC_ON; + func_8089AD70(this); + } + } + + this->actor.speedXZ = 0.0f; + this->unk_290 = arg1; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = func_8089C0DC; +} + +void func_8089C0DC(EnDinofos* this, GlobalContext* globalCtx) { + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x1000); + this->actor.world.rot.y = this->actor.shape.rot.y; + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (func_801378B8(&this->skelAnime, 1.0f)) { + if (this->unk_290 == 3) { + func_8089C244(this); + } else { + func_8089C164(this); + } + } +} + +void func_8089C164(EnDinofos* this) { + if (this->unk_290 == 2) { + this->actor.speedXZ = -10.0f; + this->actor.velocity.y = 9.0f; + this->colliderJntSph.base.acFlags |= AC_ON; + } else { + this->actor.velocity.y = 12.5f; + if (this->unk_290 == 0) { + this->actor.speedXZ = 4.5f; + } + } + + this->actor.bgCheckFlags &= ~1; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_JUMP); + this->actionFunc = func_8089C1F8; +} + +void func_8089C1F8(EnDinofos* this, GlobalContext* globalCtx) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (this->actor.bgCheckFlags & 1) { + func_8089C398(this); + } +} + +void func_8089C244(EnDinofos* this) { + this->actor.bgCheckFlags &= ~1; + this->actor.speedXZ = 8.0f; + this->actor.velocity.y = 16.0f; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_JUMP); + this->unk_290 = 0; + this->unk_292 = -1; + this->actionFunc = func_8089C2A8; +} + +void func_8089C2A8(EnDinofos* this, GlobalContext* globalCtx) { + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + this->unk_290++; + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x1800); + if ((this->actor.velocity.y < 0.0f) && (this->skelAnime.animCurrentSeg == &D_06001CCC)) { + this->colliderQuad.base.atFlags |= AT_ON; + this->colliderJntSph.base.acFlags |= AC_ON; + SkelAnime_ChangeAnim(&this->skelAnime, &D_060025B4, 1.0f, 7.0f, 13.0f, 2, -2.0f); + } + + if (this->actor.bgCheckFlags & 1) { + this->colliderQuad.base.atFlags &= ~AT_ON; + func_8089C398(this); + } +} + +void func_8089C398(EnDinofos* this) { + if (this->actionFunc != func_8089C2A8) { + SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_06000AF0); + } else { + this->skelAnime.animFrameCount = SkelAnime_GetFrameCount(&D_060025B4.common); + } + + if (this->actor.speedXZ < 0.0f) { + this->unk_290 = 1; + } else { + this->unk_290 = 0; + } + + this->actor.speedXZ = 0.0f; + func_8089AD70(this); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_BOMCHU_WALK); + this->actionFunc = func_8089C44C; +} + +void func_8089C44C(EnDinofos* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + if ((this->unk_290 == 1) && (this->actor.xzDistToPlayer < 280.0f) && func_8089A968(this) && + (Rand_ZeroOne() < 0.6f)) { + func_8089CA14(this); + } else { + func_8089A9B0(this, globalCtx); + } + } +} + +void func_8089C4F8(EnDinofos* this) { + SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_060025B4); + this->colliderQuad.base.atFlags &= ~AT_BOUNCED; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); + this->unk_290 = 0; + this->unk_292 = -1; + this->actor.speedXZ = 0.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = func_8089C56C; +} + +void func_8089C56C(EnDinofos* this, GlobalContext* globalCtx) { + this->unk_290++; + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); + this->actor.world.rot.y = this->actor.shape.rot.y; + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + func_800A8514(Effect_GetParams(this->unk_2A0)); + this->colliderQuad.base.atFlags &= ~AT_ON; + func_8089A9B0(this, globalCtx); + } else if (func_801378B8(&this->skelAnime, 7.0f)) { + this->colliderQuad.base.atFlags |= AT_ON; + func_8089AD70(this); + } else if (func_801378B8(&this->skelAnime, 13.0f)) { + this->colliderQuad.base.atFlags &= ~AT_ON; + } else if (func_801378B8(&this->skelAnime, 11.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_ATTACK); + } else if (this->skelAnime.animCurrentFrame < 7.0f) { + func_8089AE00(this, globalCtx); + } +} + +void func_8089C690(EnDinofos* this) { + SkelAnime_ChangeAnim(&this->skelAnime, &D_060025B4, -1.0f, this->skelAnime.animCurrentFrame, 0.0f, 2, 0.0f); + this->colliderQuad.base.atFlags &= ~(AT_ON | AT_BOUNCED); + if (this->actionFunc != func_8089C2A8) { + this->actor.world.rot.y = this->actor.shape.rot.y; + } else { + this->actor.speedXZ = 3.0f; + } + this->actionFunc = func_8089C724; +} + +void func_8089C724(EnDinofos* this, GlobalContext* globalCtx) { + if (this->actor.bgCheckFlags & 1) { + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + } + + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + func_8089A9B0(this, globalCtx); + } +} + +void func_8089C784(EnDinofos* this) { + this->actor.speedXZ = 0.0f; + if (this->actor.velocity.y > 0.0f) { + this->actor.velocity.y = 0.0f; + } + this->actionFunc = func_8089C7B8; +} + +void func_8089C7B8(EnDinofos* this, GlobalContext* globalCtx) { + if (this->unk_290 != 0) { + this->unk_290--; + } + + if (this->unk_290 == 0) { + func_8089ACEC(this, globalCtx); + if (this->actor.colChkInfo.health == 0) { + if (this->actor.cutscene == -1) { + func_8089CFAC(this); + } else { + func_8089D2E0(this); + } + } else if (func_8089A968(this) && (this->actor.xzDistToPlayer < 100.0f)) { + func_8089CA14(this); + } else { + func_8089A9B0(this, globalCtx); + } + } +} + +void func_8089C87C(EnDinofos* this, s32 arg1) { + SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600D21C); + func_800BE5CC(&this->actor, &this->colliderJntSph, arg1); + this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); + this->actor.speedXZ = 10.0f; + if (this->actor.velocity.y > 0.0f) { + this->actor.velocity.y = 0.0f; + } + this->unk_28E = 0; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DAMAGE); + this->colliderJntSph.base.acFlags &= ~AC_ON; + func_800BCB70(&this->actor, 0x4000, 255, 0, 18); + this->actionFunc = func_8089C938; +} + +void func_8089C938(EnDinofos* this, GlobalContext* globalCtx) { + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { + if (this->actor.colChkInfo.health == 0) { + if (this->actor.cutscene == -1) { + func_8089CFAC(this); + } else { + func_8089D2E0(this); + } + } else if (this->actor.xzDistToPlayer < 280.0f) { + func_8089CA14(this); + } else { + this->colliderJntSph.base.acFlags |= AC_ON; + func_8089A9B0(this, globalCtx); + } + } +} + +void func_8089CA14(EnDinofos* this) { + SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06001040, -5.0f); + this->colliderJntSph.base.acFlags |= AC_ON; + this->actor.speedXZ = 0.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = func_8089CA74; +} + +void func_8089CA74(EnDinofos* this, GlobalContext* globalCtx) { + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); + Math_StepToF(&this->actor.speedXZ, 0.0f, 0.5f); + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + func_8089CB10(this, globalCtx); + } else if (!func_8089AE00(this, globalCtx) && func_801378B8(&this->skelAnime, 12.0f)) { + this->actor.speedXZ = 8.0f; + } +} + +void func_8089CB10(EnDinofos* this, GlobalContext* globalCtx) { + s32 i; + Sphere16* worldSphere; + + SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060013C0); + this->unk_290 = 20; + this->actor.speedXZ = 0.0f; + this->colliderJntSph.base.atFlags |= AT_ON; + func_8089AD70(this); + + for (i = 6; i < ARRAY_COUNT(this->colliderJntSphElement); i++) { + worldSphere = &this->colliderJntSph.elements[i].dim.worldSphere; + worldSphere->center.x = this->unk_34C.x; + worldSphere->center.y = this->unk_34C.y; + worldSphere->center.z = this->unk_34C.z; + } + + if (globalCtx->sceneNum == SCENE_MITURIN) { + globalCtx->envCtx.unk_C3 = 11; + } + + this->actionFunc = func_8089CBEC; +} + +void func_8089CBEC(EnDinofos* this, GlobalContext* globalCtx) { + s16 temp_s3 = ((s32)randPlusMinusPoint5Scaled(0x1000) + this->actor.shape.rot.y) + this->unk_28E; + Vec3f sp88; + Vec3f sp7C; + ColliderJntSphElementDim* dim; + s32 i; + s32 end; + f32 temp_f20; + f32 temp_f22; + s32 temp_s0; + + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); + temp_f20 = Math_SinS(temp_s3); + temp_f22 = Math_CosS(temp_s3); + + temp_s0 = 10 - this->unk_290; + temp_s0 = CLAMP_MIN(temp_s0, 0); + + sp88.x = 11.0f * temp_f20; + sp88.y = randPlusMinusPoint5Scaled(2.0f) + -5.4f; + sp88.z = 11.0f * temp_f22; + sp7C.x = 0.9f * temp_f20; + sp7C.y = randPlusMinusPoint5Scaled(0.6f) + 1.4f; + sp7C.z = 0.9f * temp_f22; + func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); + EffectSsDFire_Spawn(globalCtx, &this->unk_34C, &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, 3, 8); + + for (end = 6, i = 3; i > 0; i--) { + if (this->unk_290 < (20 + -(i * 2))) { + end = i + 6; + break; + } + } + + for (i = 6; i < end; i++) { + dim = &this->colliderJntSph.elements[i].dim; + temp_s3 = (s32)(cos_rad((this->unk_290 + ((i - 5) << 1)) * (M_PI / 20)) * 0x2C00) + this->actor.shape.rot.y; + + dim->worldSphere.center.x = (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z) + (s32)this->unk_34C.x; + dim->worldSphere.center.y = (s32)this->unk_34C.y + (s32)dim->modelSphere.center.y; + dim->worldSphere.center.z = (s32)(Math_CosS(temp_s3) * dim->modelSphere.center.z) + (s32)this->unk_34C.z; + } + + if (this->unk_290 != 0) { + this->unk_290--; + } else { + func_8089CF00(this, globalCtx); + } +} + +void func_8089CF00(EnDinofos* this, GlobalContext* globalCtx) { + SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_060017B8); + this->colliderJntSph.base.atFlags &= ~AT_ON; + if (globalCtx->sceneNum == SCENE_MITURIN) { + globalCtx->envCtx.unk_C3 = 255; + } + this->actionFunc = func_8089CF70; +} + +void func_8089CF70(EnDinofos* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + func_8089A9B0(this, globalCtx); + } +} + +void func_8089CFAC(EnDinofos* this) { + SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_0600ABD0); + this->actor.flags &= ~1; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DEAD); + this->actor.speedXZ = 0.0f; + this->actor.world.rot.y = this->actor.shape.rot.y; + this->actionFunc = func_8089D018; +} + +void func_8089D018(EnDinofos* this, GlobalContext* globalCtx) { + if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { + s32 temp_v0 = this->unk_288 - 10; + + if (this->actor.category == ACTORCAT_ENEMY) { + func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_PROP); + func_8089ABF4(this, globalCtx); + } + + if (temp_v0 <= 0) { + Actor_MarkForDeath(&this->actor); + this->unk_288 = 0; + } else { + this->unk_288 = temp_v0; + } + + if (this->unk_2B0 > 0.0f) { + this->unk_2B0 = this->unk_288 * (1.0f / 255.0f); + } + + this->actor.shape.shadowAlpha = this->unk_288; + } else if (func_801378B8(&this->skelAnime, 26.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_DOWN); + } +} + +void func_8089D11C(EnDinofos* this, s16 arg1) { + if (arg1 >= 0) { + this->actor.speedXZ = -15.0f; + } else { + this->actor.speedXZ = 15.0f; + } + SkelAnime_ChangeAnim(&this->skelAnime, &D_0600D62C, this->actor.speedXZ * (1.0f / 7.5f), 0.0f, 0.0f, 0, -4.0f); + this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); + this->unk_292 = 10; + this->unk_2A4 = 0.0f; + func_8089AD70(this); + this->actionFunc = func_8089D1E0; +} + +void func_8089D1E0(EnDinofos* this, GlobalContext* globalCtx) { + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xBB8); + Math_StepToF(&this->actor.speedXZ, 0.0f, 2.0f); + + this->skelAnime.animPlaybackSpeed = + (1.0f + fabsf(this->actor.speedXZ * (1.0f / 15.0f))) * ((this->actor.speedXZ >= 0.0f) ? 1.0f : -1.0f); + this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (this->unk_292 != 0) { + this->unk_292--; + } else { + func_8089A9B0(this, globalCtx); + } + + if (func_801378B8(&this->skelAnime, 0.0f) || func_801378B8(&this->skelAnime, 5.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_WALK); + } +} + +void func_8089D2E0(EnDinofos* this) { + ActorCutscene_SetIntentToPlay(this->actor.cutscene); + this->actionFunc = func_8089D318; +} + +void func_8089D318(EnDinofos* this, GlobalContext* globalCtx) { + Vec3f sp24; + + if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { + if (this->actor.colChkInfo.health == 0) { + ActorCutscene_Start(this->actor.cutscene, &this->actor); + func_800B724C(globalCtx, &this->actor, 7); + } else { + ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); + } + this->camId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + if (this->actor.colChkInfo.health == 0) { + sp24.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.x; + sp24.y = this->actor.focus.pos.y; + sp24.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.z; + func_8016970C(globalCtx, this->camId, &this->actor.focus.pos, &sp24); + func_8089CFAC(this); + } else { + func_8089B100(this, globalCtx); + } + } else { + ActorCutscene_SetIntentToPlay(this->actor.cutscene); + } +} + +void func_8089D42C(EnDinofos* this, GlobalContext* globalCtx) { + s16 temp_v0_2; + + if ((this->actionFunc == func_8089B834) && (this->unk_290 != 0)) { + Math_ScaledStepToS(&this->unk_28E, Math_SinS(this->unk_290 * 1400) * 0x2C00, 0x300); + } else if (this->actionFunc == func_8089CA74) { + Math_ScaledStepToS(&this->unk_28E, cos_rad(M_PI) * 0x2C00, 0x233); + } else if (this->actionFunc == func_8089CBEC) { + this->unk_28E = cos_rad(this->unk_290 * (M_PI / 20)) * 0x2C00; + } else if (!func_801690CC(globalCtx)) { + temp_v0_2 = this->unk_28E + this->actor.shape.rot.y; + temp_v0_2 = BINANG_SUB(this->actor.yawTowardsPlayer, temp_v0_2); + temp_v0_2 = CLAMP(temp_v0_2, -0x300, 0x300); + this->unk_28E += temp_v0_2; + this->unk_28E = CLAMP(this->unk_28E, -0x2C00, 0x2C00); + } +} + +s32 func_8089D60C(EnDinofos* this, GlobalContext* globalCtx) { + s32 i; + + if (this->colliderJntSph.base.acFlags & AC_HIT) { + this->colliderJntSph.base.acFlags &= ~AC_HIT; + func_800BE2B8(&this->actor, &this->colliderJntSph); + + for (i = 0; i < ARRAY_COUNT(this->colliderJntSphElement); i++) { + if (this->colliderJntSph.elements[i].info.bumperFlags & BUMP_HIT) { + break; + } + } + + if (i == ARRAY_COUNT(this->colliderJntSphElement)) { + return false; + } + + if ((this->unk_28A == 10) && (this->colliderJntSph.elements[i].info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { + return false; + } + + if (this->actor.colChkInfo.damageEffect == 0xF) { + return false; + } + + if (!func_800BE22C(&this->actor)) { + func_800BBA88(globalCtx, &this->actor); + D_8089E350--; + if (D_8089E350 == 0) { + if (D_8089E34C != -1) { + this->actor.cutscene = D_8089E34C; + } + } + + if (this->actor.cutscene != -1) { + func_801A2ED8(); + } + } + + func_8089ACEC(this, globalCtx); + func_8089AD70(this); + if (globalCtx->sceneNum == SCENE_MITURIN) { + globalCtx->envCtx.unk_C3 = 255; + } + + this->colliderQuad.base.atFlags &= ~(AT_ON | AT_BOUNCED); + this->colliderJntSph.base.atFlags &= ~AT_ON; + if (this->actor.colChkInfo.damageEffect == 3) { + func_8089AC70(this); + if (this->actor.colChkInfo.health == 0) { + this->unk_290 = 3; + this->colliderJntSph.base.acFlags &= ~AC_ON; + } + func_8089C784(this); + return true; + } + + if (this->actor.colChkInfo.damageEffect == 1) { + this->unk_290 = 40; + func_800BCB70(&this->actor, 0, 255, 0, 40); + Audio_PlayActorSound2(&this->actor, NA_SE_EN_COMMON_FREEZE); + func_8089C784(this); + return true; + } + + if (this->actor.colChkInfo.damageEffect == 5) { + this->unk_290 = 40; + func_800BCB70(&this->actor, 0, 255, 0, 40); + this->unk_2B4 = 0.55f; + this->unk_2B0 = 2.0f; + this->unk_28A = 31; + Audio_PlayActorSound2(&this->actor, NA_SE_EN_COMMON_FREEZE); + func_8089C784(this); + return true; + } + + if (this->actor.colChkInfo.damageEffect == 2) { + this->unk_2B0 = 4.0f; + this->unk_2B4 = 0.55f; + this->unk_28A = 0; + } else if (this->actor.colChkInfo.damageEffect == 4) { + this->unk_2B0 = 4.0f; + this->unk_2B4 = 0.55f; + this->unk_28A = 20; + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, + this->colliderJntSph.elements[i].info.bumper.hitPos.x, + this->colliderJntSph.elements[i].info.bumper.hitPos.y, + this->colliderJntSph.elements[i].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_LARGE_LIGHT_RAYS); + } + func_8089C87C(this, i); + return true; + } + + return false; +} + +void EnDinofos_Update(Actor* thisx, GlobalContext* globalCtx2) { + EnDinofos* this = THIS; + GlobalContext* globalCtx = globalCtx2; + s32 pad; + Vec3f sp30; + + if (this->actionFunc != func_8089C7B8) { + func_8089A900(this); + } + + if (!func_8089D60C(this, globalCtx) && (this->colliderQuad.base.atFlags & AT_BOUNCED)) { + func_8089C690(this); + } + + this->actionFunc(this, globalCtx); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 30.0f, 60.0f, 0x5D); + if (this->actionFunc != func_8089C7B8) { + if ((this->actor.yDistToWater > 0.0f) && (this->actor.yDistToWater < 10.0f)) { + if (!((globalCtx->gameplayFrames % 4) & 1)) { + Math_Vec3f_Copy(&sp30, &this->unk_2D4[1 + (globalCtx->gameplayFrames % 4)]); + sp30.y = this->actor.world.pos.y + this->actor.yDistToWater; + EffectSsGRipple_Spawn(globalCtx, &sp30, 100, 320, 0); + } + } + if (this->actionFunc != func_8089D018) { + func_8089D42C(this, globalCtx); + } + } + + if ((this->actionFunc == func_8089D018) || (this->actionFunc == func_8089C938)) { + Math_ScaledStepToS(&this->unk_28E, 0, 2000); + } + + Math_Vec3f_Copy(&this->actor.focus.pos, &this->unk_304); + this->actor.focus.rot.y = this->actor.shape.rot.y + this->unk_28E; + if (this->colliderJntSph.base.acFlags & AC_ON) { + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + } + + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + if (this->colliderJntSph.base.atFlags & AT_ON) { + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderJntSph.base); + } + + if (this->colliderQuad.base.atFlags & AT_ON) { + CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->colliderQuad.base); + } + + if (this->unk_2B0 > 0.0f) { + if (this->unk_28A != 10) { + Math_StepToF(&this->unk_2B0, 0.0f, 0.05f); + this->unk_2B4 = (this->unk_2B0 + 1.0f) * (11.0f / 40.0f); + this->unk_2B4 = CLAMP_MAX(this->unk_2B4, 0.55f); + } else if (!Math_StepToF(&this->unk_2B8, 0.55f, 0.01375f)) { + func_800B9010(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); + } + } +} + +s32 func_8089DC4C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + EnDinofos* this = THIS; + + if (limbIndex == 16) { + rot->y -= this->unk_28E; + } + + return 0; +} + +void func_8089DC84(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { + static Vec3f D_8089E38C = { 400.0f, -3600.0f, 0.0f }; + static Vec3f D_8089E398 = { 300.0f, 500.0f, 0.0f }; + static Vec3f D_8089E3A4 = { 700.0f, 400.0f, 0.0f }; + static s8 D_8089E3B0[] = { + -1, -1, 0, -1, 1, 2, -1, 3, 4, -1, 5, 6, -1, 7, 8, -1, 9, 10, -1, 11, -1, + }; + + EnDinofos* this = THIS; + Vec3f sp80; + Vec3f sp74; + Vec3f sp68; + Vec3f sp5C; + s32 sp58; + Vec3f sp4C; + MtxF* sp48; + + Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); + if (D_8089E3B0[limbIndex] != -1) { + SysMatrix_GetStateTranslation(&this->unk_2D4[D_8089E3B0[limbIndex]]); + } + + if ((limbIndex == 14) && (this->unk_292 != this->unk_290) && + ((this->actionFunc == func_8089C56C) || (this->actionFunc == func_8089C2A8))) { + Math_Vec3f_Copy(&sp74, &this->colliderQuad.dim.quad[0]); + Math_Vec3f_Copy(&sp80, &this->colliderQuad.dim.quad[1]); + SysMatrix_MultiplyVector3fByState(&D_8089E38C, &sp68); + SysMatrix_MultiplyVector3fByState(&D_8089E398, &sp5C); + Collider_SetQuadVertices(&this->colliderQuad, &sp5C, &sp68, &sp74, &sp80); + if (this->colliderQuad.base.atFlags & AT_ON) { + func_800A81F0(Effect_GetParams(this->unk_2A0), &sp68, &sp5C); + } + this->unk_292 = this->unk_290; + } + + if (limbIndex == 4) { + SysMatrix_GetStateTranslationAndScaledX(300.0f, &this->actor.shape.feetPos[0]); + } else if (limbIndex == 7) { + SysMatrix_GetStateTranslationAndScaledX(300.0f, &this->actor.shape.feetPos[1]); + } + + if ((limbIndex == 16) && (this->actionFunc == func_8089B580)) { + if ((this->skelAnime.animCurrentFrame > 38.0f) && (this->skelAnime.animCurrentFrame <= 55.0f) && + (this->unk_292 != this->unk_290)) { + sp48 = SysMatrix_GetCurrentState(); + sp58 = 48 - (s32)this->skelAnime.animCurrentFrame; + sp58 = CLAMP_MIN(sp58, 0); + SysMatrix_MultiplyVector3fByState(&D_8089E3A4, &sp4C); + sp4C.x -= sp48->mf[3][0]; + sp4C.y -= sp48->mf[3][1]; + sp4C.z -= sp48->mf[3][2]; + EffectSsDFire_Spawn(globalCtx, &this->unk_34C, &sp4C, &D_801D15B0, 30, 22, 255 - (sp58 * 20), 20, 3, 8); + this->unk_292 = this->unk_290; + } + } +} + +void EnDinofos_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnDinofos* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + if (this->unk_288 == 255) { + func_8012C28C(globalCtx->state.gfxCtx); + func_800B8050(&this->actor, globalCtx, 0); + + gSPSegment(POLY_OPA_DISP++, 0x08, D_8089E33C[this->unk_289]); + gDPSetEnvColor(POLY_OPA_DISP++, 20, 40, 40, 255); + + Scene_SetRenderModeXlu(globalCtx, 0, 1); + POLY_OPA_DISP = + SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, + this->skelAnime.dListCount, func_8089DC4C, func_8089DC84, &this->actor, POLY_OPA_DISP); + } else { + func_8012C2DC(globalCtx->state.gfxCtx); + func_800B8118(&this->actor, globalCtx, 0); + + gSPSegment(POLY_XLU_DISP++, 0x08, D_8089E33C[this->unk_289]); + gDPSetEnvColor(POLY_XLU_DISP++, 20, 40, 40, this->unk_288); + + Scene_SetRenderModeXlu(globalCtx, 1, 2); + POLY_XLU_DISP = + SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, + this->skelAnime.dListCount, func_8089DC4C, func_8089DC84, &this->actor, POLY_XLU_DISP); + } + + func_800BE680(globalCtx, &this->actor, this->unk_2D4, 12, this->unk_2B4, this->unk_2B8, this->unk_2B0, + this->unk_28A); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h index 31b0914daa..4ed2a76ab8 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h @@ -5,13 +5,43 @@ struct EnDinofos; -typedef void (*EnDinofosActionFunc)(struct EnDinofos* this, GlobalContext* globalCtx); +typedef void (*EnDinofosActionFunc)(struct EnDinofos*, GlobalContext*); typedef struct EnDinofos { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x140]; - /* 0x0284 */ EnDinofosActionFunc actionFunc; - /* 0x0288 */ char unk_288[0x3BC]; + /* 0x000 */ Actor actor; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[21]; + /* 0x206 */ Vec3s morphTable[21]; + /* 0x284 */ EnDinofosActionFunc actionFunc; + /* 0x288 */ u8 unk_288; + /* 0x289 */ u8 unk_289; + /* 0x28A */ u8 unk_28A; + /* 0x28B */ u8 unk_28B; + /* 0x28C */ s16 unk_28C; + /* 0x28E */ s16 unk_28E; + /* 0x290 */ s16 unk_290; + /* 0x290 */ s16 unk_292; + /* 0x294 */ UNK_TYPE1 unk_294[4]; + /* 0x298 */ s16 camId; + /* 0x29A */ Vec3s unk_29A; + /* 0x2A0 */ s32 unk_2A0; + /* 0x2A4 */ f32 unk_2A4; + /* 0x2A8 */ f32 unk_2A8; + /* 0x2AC */ f32 unk_2AC; + /* 0x2B0 */ f32 unk_2B0; + /* 0x2B4 */ f32 unk_2B4; + /* 0x2B8 */ f32 unk_2B8; + /* 0x2BC */ Vec3f unk_2BC; + /* 0x2C8 */ Vec3f unk_2C8; + /* 0x2D4 */ Vec3f unk_2D4[4]; + /* 0x304 */ Vec3f unk_304; + /* 0x310 */ UNK_TYPE1 unk_310[0x3C]; + /* 0x34C */ Vec3f unk_34C; + /* 0x358 */ UNK_TYPE1 unk_358[0xC]; + /* 0x364 */ ColliderJntSph colliderJntSph; + /* 0x384 */ ColliderJntSphElement colliderJntSphElement[9]; + /* 0x5C4 */ ColliderQuad colliderQuad; + } EnDinofos; // size = 0x644 extern const ActorInit En_Dinofos_InitVars; diff --git a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h index e3e0f936bd..1d199eee67 100644 --- a/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h +++ b/src/overlays/effects/ovl_Effect_Ss_D_Fire/z_eff_ss_d_fire.h @@ -11,8 +11,9 @@ typedef struct { /* 0x26 */ s16 scaleStep; /* 0x28 */ s16 alpha; /* 0x2A */ s16 fadeDelay; - /* 0x2C */ s32 life; -} EffectSsDFireInitParams; // size = 0x30 + /* 0x2C */ s16 life; + /* 0x30 */ s32 unk_30; +} EffectSsDFireInitParams; // size = 0x34 extern const EffectSsInit Effect_Ss_D_Fire_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index a6f51b4c9f..3950de0719 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1797,6 +1797,9 @@ D_0600ABD0 = 0x0600ABD0; D_0600C974 = 0x0600C974; D_0600D21C = 0x0600D21C; D_0600D62C = 0x0600D62C; +D_06008E30 = 0x06008E30; +D_06009030 = 0x06009030; +D_06009230 = 0x06009230; // ovl_En_Dnb