From 4ee7dc1da6915c18af00153b0dae1cd0b143607d Mon Sep 17 00:00:00 2001 From: Maide <34639600+Kelebek1@users.noreply.github.com> Date: Tue, 4 Jan 2022 03:57:40 +0000 Subject: [PATCH] En_Bomjima (1 non-equiv) (#433) * En_Bomjima * Damn caps * PR * PR * undef * PR --- assets/xml/objects/object_cs.xml | 2 +- assets/xml/overlays/ovl_En_Bomjima.xml | 6 + spec | 1 - .../actors/ovl_En_Bombal/z_en_bombal.h | 7 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 1083 ++++++++++++++++- .../actors/ovl_En_Bomjima/z_en_bomjima.h | 48 +- tools/disasm/functions.txt | 2 +- undefined_syms.txt | 2 +- 8 files changed, 1102 insertions(+), 49 deletions(-) create mode 100644 assets/xml/overlays/ovl_En_Bomjima.xml diff --git a/assets/xml/objects/object_cs.xml b/assets/xml/objects/object_cs.xml index 7fff51fd8..65cff1d46 100644 --- a/assets/xml/objects/object_cs.xml +++ b/assets/xml/objects/object_cs.xml @@ -49,7 +49,7 @@ - + diff --git a/assets/xml/overlays/ovl_En_Bomjima.xml b/assets/xml/overlays/ovl_En_Bomjima.xml new file mode 100644 index 000000000..5aada4887 --- /dev/null +++ b/assets/xml/overlays/ovl_En_Bomjima.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/spec b/spec index 9a74b21bf..72b38bdda 100644 --- a/spec +++ b/spec @@ -5107,7 +5107,6 @@ beginseg name "ovl_En_Bomjima" compress include "build/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.o" - include "build/data/ovl_En_Bomjima/ovl_En_Bomjima.data.o" include "build/data/ovl_En_Bomjima/ovl_En_Bomjima.reloc.o" endseg diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h index ce6fd6724..9ac9fafa0 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h @@ -10,7 +10,12 @@ typedef void (*EnBombalActionFunc)(struct EnBombal*, GlobalContext*); typedef struct EnBombal { /* 0x0000 */ Actor actor; /* 0x0144 */ EnBombalActionFunc actionFunc; - /* 0x0148 */ char unk_148[0x28FC]; + /* 0x0148 */ char unk148[0x4]; + /* 0x014C */ s16 unk_14C; + /* 0x0150 */ f32 unk_150; + /* 0x0154 */ char unk154[0x150]; + /* 0x02A4 */ Vec3f unk_2A4; + /* 0x02B0 */ char unk2B0[0x2794]; } EnBombal; // size = 0x2A44 extern const ActorInit En_Bombal_InitVars; diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index 5a003ef85..d06c2a060 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -4,7 +4,9 @@ * Description: Bombers - Jim */ +#include "overlays/actors/ovl_En_Bombal/z_en_bombal.h" #include "z_en_bomjima.h" +#include "objects/object_cs/object_cs.h" #define FLAGS 0x00000019 @@ -16,8 +18,11 @@ void EnBomjima_Update(Actor* thisx, GlobalContext* globalCtx); void EnBomjima_Draw(Actor* thisx, GlobalContext* globalCtx); void func_80BFEA94(EnBomjima* this, GlobalContext* globalCtx); +void func_80BFEB1C(EnBomjima* this); void func_80BFEB64(EnBomjima* this, GlobalContext* globalCtx); +void func_80BFEFF0(EnBomjima* this); void func_80BFF03C(EnBomjima* this, GlobalContext* globalCtx); +void func_80BFF120(EnBomjima* this); void func_80BFF174(EnBomjima* this, GlobalContext* globalCtx); void func_80BFF430(EnBomjima* this, GlobalContext* globalCtx); void func_80BFF52C(EnBomjima* this, GlobalContext* globalCtx); @@ -26,13 +31,17 @@ void func_80BFF754(EnBomjima* this, GlobalContext* globalCtx); void func_80BFF9B0(EnBomjima* this, GlobalContext* globalCtx); void func_80BFFB40(EnBomjima* this, GlobalContext* globalCtx); void func_80BFFBC4(EnBomjima* this, GlobalContext* globalCtx); +void func_80BFFCFC(EnBomjima* this); void func_80BFFD48(EnBomjima* this, GlobalContext* globalCtx); void func_80BFFE48(EnBomjima* this, GlobalContext* globalCtx); void func_80BFFF54(EnBomjima* this, GlobalContext* globalCtx); void func_80C00168(EnBomjima* this, GlobalContext* globalCtx); +void func_80C00234(EnBomjima* this); void func_80C00284(EnBomjima* this, GlobalContext* globalCtx); -#if 0 +static s32 D_80C009F0 = 0; +static s32 D_80C009F4 = 0; + const ActorInit En_Bomjima_InitVars = { ACTOR_EN_BOMJIMA, ACTORCAT_NPC, @@ -45,83 +54,1075 @@ const ActorInit En_Bomjima_InitVars = { (ActorFunc)EnBomjima_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80C00A18 = { - { COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_PLAYER, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_NONE, + OCELEM_ON, + }, { 10, 30, 0, { 0, 0, 0 } }, }; +static u16 D_80C00A44[] = { + 0x0719, + 0x071A, + 0x071B, + 0x0708, +}; + +static u16 D_80C00A4C[] = { + 0x0739, + 0x073A, + 0x073B, + 0x0000, +}; + +static u16 D_80C00A54[] = { 0x0739, 0x073A, 0x073B, 0x0714, 0x0709, 0x070A, 0x070B, + 0x070C, 0x070D, 0x070E, 0x070F, 0x0712, 0x0713 }; + +static u16 D_80C00A70[] = { 0x0739, 0x073A, 0x073B, 0x0759, 0x0753, 0x0754, 0x0755, + 0x0756, 0x070D, 0x0757, 0x0758, 0x0712, 0x0713 }; + +static u16 D_80C00A8C[] = { + 0x0736, + 0x0737, + 0x0738, + 0x074E, +}; + +static AnimationHeader* sAnimations[] = { + &object_cs_Anim_0064B8, &object_cs_Anim_00FAF4, &object_cs_Anim_0057C8, &object_cs_Anim_0053F4, + &object_cs_Anim_002044, &object_cs_Anim_01007C, &object_cs_Anim_00349C, &object_cs_Anim_004960, + &object_cs_Anim_005128, &object_cs_Anim_004C1C, &object_cs_Anim_001A1C, &object_cs_Anim_003EE4, + &object_cs_Anim_00478C, &object_cs_Anim_00433C, &object_cs_Anim_0060E8, &object_cs_Anim_001708, + &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, &object_cs_Anim_0036B0, &object_cs_Anim_0031C4, +}; + +static u8 D_80C00AE4[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, +}; + +void EnBomjima_Init(Actor* thisx, GlobalContext* globalCtx) { + EnBomjima* this = THIS; + s32 cs; + s32 i; + + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 19.0f); + this->actor.gravity = -3.0f; + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_cs_Skel_00F82C, &object_cs_Anim_0064B8, this->jointTable, + this->morphTable, 21); + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + gSaveContext.weekEventReg[83] &= (u8)~0x4; + this->actor.targetMode = 0; + this->unk_2E6 = ENBOMJIMA_GET_F0(&this->actor); + this->unk_2E4 = ENBOMJIMA_GET_F(&this->actor); + Actor_SetScale(&this->actor, 0.01f); + + if (this->unk_2E6 == 0) { + cs = this->actor.cutscene; + i = 0; + + while (cs != -1) { + // clang-format off + this->unk_2D4[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); + // clang-format on + i++; + } + + this->actionFunc = func_80BFEA94; + } else if (this->unk_2E6 == 2) { + func_80BFFCFC(this); + } + + if ((gSaveContext.weekEventReg[75] & 0x40) || (gSaveContext.weekEventReg[73] & 0x10) || + (gSaveContext.weekEventReg[85] & 2)) { + Actor_MarkForDeath(&this->actor); + } +} + +void EnBomjima_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnBomjima* this = THIS; + + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void func_80BFE32C(EnBomjima* this, GlobalContext* globalCtx, s32 arg2) { + Player* player = GET_PLAYER(globalCtx); + + this->unk_2CA = arg2; + if (player->transformation == PLAYER_FORM_GORON) { + this->unk_2C8 = 1; + } + if (player->transformation == PLAYER_FORM_ZORA) { + this->unk_2C8 = 2; + } + + switch (this->unk_2CA) { + case 0: + if (player->transformation == PLAYER_FORM_DEKU) { + this->actor.textId = 0x759; + if (!(gSaveContext.weekEventReg[73] & 0x20)) { + this->actor.textId = 0x708; + } + } else if (player->transformation == PLAYER_FORM_HUMAN) { + this->actor.textId = 0x75A; + if (!(gSaveContext.weekEventReg[84] & 0x80)) { + this->actor.textId = 0x719; + } + } else if ((this->unk_2C8 == 1) || (this->unk_2C8 == 2)) { + this->actor.textId = D_80C00A44[this->unk_2C8]; + } + break; + + case 1: + this->actor.textId = D_80C00A4C[this->unk_2C8]; + break; + + case 2: + if (player->transformation == PLAYER_FORM_DEKU) { + this->actor.textId = D_80C00A54[this->unk_2C8]; + return; + } + this->actor.textId = D_80C00A70[this->unk_2C8]; + break; + + case 3: + this->actor.textId = D_80C00A8C[this->unk_2C8]; + break; + } +} + +void func_80BFE494(EnBomjima* this, s32 arg1, f32 arg2) { + this->unk_2EC = arg1; + this->unk_2CC = Animation_GetLastFrame(sAnimations[arg1]); + Animation_Change(&this->skelAnime, sAnimations[this->unk_2EC], arg2, 0.0f, this->unk_2CC, D_80C00AE4[this->unk_2EC], + -4.0f); +} + +void func_80BFE524(EnBomjima* this) { + if ((this->unk_2EC == 5) && + (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || + Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMBERS_WALK); + } + + if ((this->unk_2EC == 18) && + (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || + Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMBERS_WALK); + } + + if ((this->unk_2EC == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMBERS_LAND); + } + + if ((this->unk_2EC == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMBERS_LAND); + } +} + +void func_80BFE65C(EnBomjima* this) { + this->unk_2BC = 0; + this->unk_2C0 = 0; + this->unk_2BE = 0; + this->unk_2A2 = 0; + this->unk_290 = 0; + this->unk_29A = 0; +} + +void func_80BFE67C(EnBomjima* this, GlobalContext* globalCtx) { + f32 sp84 = this->skelAnime.curFrame; + f32 x; + f32 z; + s16 abs; + s16 abs2; + Vec3f sp6C; + Vec3f sp60; + Vec3f sp54; + CollisionPoly* sp50; + s32 sp4C; + + this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A4); + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); + + switch (this->unk_2A2) { + case 0: + if (this->unk_2C0 == 0) { + Math_Vec3f_Copy(&sp54, &this->actor.home.pos); + + sp54.x += randPlusMinusPoint5Scaled(150.0f); + sp54.z += randPlusMinusPoint5Scaled(150.0f); + + abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp54))); + if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp54, &sp6C, + &sp50, 1, 0, 0, 1, &sp4C)) { + func_80BFE494(this, 5, 1.0f); + Math_Vec3f_Copy(&this->unk_2A4, &sp54); + this->unk_2BE = Rand_S16Offset(30, 50); + this->unk_2A2++; + } + } + break; + + case 1: + if (sp84 >= 0.0f) { + this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A4); + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 10, 2000, 20); + } + + abs2 = BINANG_SUB(this->actor.world.rot.y, this->unk_2DC); + if ((s16)ABS_ALT(abs2) < 0x100) { + Math_Vec3f_Copy(&sp60, &this->actor.world.pos); + + sp60.x += Math_SinS(this->actor.world.rot.y) * 60.0f; + sp60.z += Math_CosS(this->actor.world.rot.y) * 60.0f; + + if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &sp60, &sp6C, &sp50, 1, 0, 0, 1, + &sp4C)) { + this->unk_2C0 = 0; + if (Rand_ZeroOne() < 0.5f) { + func_80BFE494(this, 19, 1.0f); + } else { + func_80BFE494(this, 0, 1.0f); + } + this->unk_2A2 = 0; + this->unk_2D0 = 0.0f; + break; + } + } + + x = this->unk_2A4.x - this->actor.world.pos.x; + z = this->unk_2A4.z - this->actor.world.pos.z; + + if ((this->unk_2BE == 0) || (sqrtf(SQ(x) + SQ(z)) < 4.0f)) { + this->unk_2C0 = Rand_S16Offset(20, 20); + if (!(this->unk_2C0 & 1)) { + func_80BFE494(this, 19, 1.0f); + } else { + func_80BFE494(this, 0, 1.0f); + } + this->unk_2A2 = 0; + this->unk_2D0 = 0.0f; + } else if (sp84 >= 0.0f) { + Math_ApproachF(&this->actor.world.pos.x, this->unk_2A4.x, 0.3f, this->unk_2D0); + Math_ApproachF(&this->actor.world.pos.z, this->unk_2A4.z, 0.3f, this->unk_2D0); + Math_ApproachF(&this->unk_2D0, 1.0f, 0.3f, 0.5f); + } + break; + } +} + +void func_80BFEA94(EnBomjima* this, GlobalContext* globalCtx) { + Actor* actor = globalCtx->actorCtx.actorList[ACTORCAT_PROP].first; + + while (actor != NULL) { + if (actor->id != ACTOR_EN_BOMBAL) { + actor = actor->next; + continue; + } + + this->unk_2F0 = (EnBombal*)actor; + Math_Vec3f_Copy(&this->unk_2B0, &actor->world.pos); + if (this->unk_2F4 == 0) { + this->unk_2F4 = this->unk_2F0->actor.cutscene; + } + func_80BFEB1C(this); + break; + } +} + +void func_80BFEB1C(EnBomjima* this) { + func_80BFE494(this, 1, 1.0f); + func_80BFE65C(this); + this->unk_2A0 = 0; + this->actionFunc = func_80BFEB64; +} + +void func_80BFEB64(EnBomjima* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + s32 pad[2]; + Vec3f sp40; + + func_80BFE32C(this, globalCtx, 0); + if (player->transformation == PLAYER_FORM_DEKU) { + if (gSaveContext.weekEventReg[73] & 0x20) { + this->unk_2C8 = 3; + func_80BFE32C(this, globalCtx, 3); + } else if (gSaveContext.weekEventReg[77] & 2) { + this->unk_2C8 = 11; + func_80BFE32C(this, globalCtx, 2); + } + } else if (player->transformation == PLAYER_FORM_HUMAN) { + if (gSaveContext.weekEventReg[84] & 0x80) { + this->unk_2C8 = 0; + func_80BFE32C(this, globalCtx, 3); + } else if (gSaveContext.weekEventReg[85] & 1) { + this->unk_2C8 = 11; + func_80BFE32C(this, globalCtx, 2); + } + } + + if (Text_GetFaceReaction(globalCtx, 0x11) != 0) { + this->actor.textId = Text_GetFaceReaction(globalCtx, 0x11); + } + + if (func_800B84D0(&this->actor, globalCtx)) { + this->unk_2DC = this->actor.yawTowardsPlayer; + func_80C00234(this); + return; + } + + if (ActorCutscene_GetCurrentIndex() == -1) { + func_800B8614(&this->actor, globalCtx, 70.0f); + } + + if ((this->unk_2F0->actor.update == NULL) || (this->unk_2F0->actor.colChkInfo.health == 0)) { + func_80BFEFF0(this); + return; + } + + switch (this->unk_2A2) { + case 0: + func_80BFE494(this, 4, 1.0f); + this->unk_29A = -7000; + this->unk_2A2++; + break; + + case 1: + this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2F0->actor.world.pos); + if (Animation_OnFrame(&this->skelAnime, 19.0f)) { + this->unk_2C0 = 5; + Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMBERS_SHOT_BREATH); + } + + if (this->unk_2C0 == 1) { + s16 sp3E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2F0->actor.world.pos); + + if (Rand_ZeroOne() < 0.5f) { + sp3E += 0x4000; + } else { + sp3E += 0xC000; + } + + sp40.x = (Math_SinS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->unk_2F0->actor.world.pos.x; + sp40.y = this->unk_2F0->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f); + sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->unk_2F0->actor.world.pos.z; + + Audio_PlaySoundAtPosition(globalCtx, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN); + EffectSsHitMark_SpawnFixedScale(globalCtx, 0, &sp40); + this->unk_2BC++; + + if (((s16)Rand_ZeroFloat(2.0f) + 3) < this->unk_2BC) { + func_80BFE494(this, 5, 1.0f); + this->unk_29A = 0; + Math_Vec3f_Copy(&this->unk_2A4, &this->actor.home.pos); + this->unk_2A4.x += randPlusMinusPoint5Scaled(150.0f); + this->unk_2A4.z += randPlusMinusPoint5Scaled(150.0f); + this->unk_2A2++; + } + } + break; + + case 2: + this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A4); + Math_ApproachF(&this->actor.world.pos.x, this->unk_2A4.x, 0.3f, 2.0f); + Math_ApproachF(&this->actor.world.pos.z, this->unk_2A4.z, 0.3f, 2.0f); + if (sqrtf(SQ(this->actor.world.pos.x - this->unk_2A4.x) + SQ(this->actor.world.pos.z - this->unk_2A4.z)) < + 4.0f) { + func_80BFE65C(this); + } + break; + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); +} + +void func_80BFEFF0(EnBomjima* this) { + this->unk_2F0 = NULL; + func_80BFE494(this, 19, 1.0f); + func_80BFE65C(this); + this->unk_2A0 = 1; + this->actionFunc = func_80BFF03C; +} + +void func_80BFF03C(EnBomjima* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_2D4[0]); + } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D4[0])) { + ActorCutscene_SetIntentToPlay(this->unk_2D4[0]); + } else { + player->stateFlags1 &= ~0x20; + gSaveContext.weekEventReg[83] &= (u8)~4; + this->actor.world.rot.y = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)); + this->unk_2DC = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)); + ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[0], &this->actor); + func_80BFF120(this); + } +} + +void func_80BFF120(EnBomjima* this) { + func_80BFE65C(this); + this->unk_2C4 = 30; + func_80BFE494(this, 6, 1.0f); + this->unk_2DE = 0; + this->unk_2A0 = 2; + this->actionFunc = func_80BFF174; +} + +void func_80BFF174(EnBomjima* this, GlobalContext* globalCtx) { + f32 sp2C = this->skelAnime.curFrame; + Player* player = GET_PLAYER(globalCtx); + + if (this->unk_2C4 == 1) { + ActorCutscene_Stop(this->unk_2D4[0]); + this->unk_2DE = 1; + } + + if (Text_GetFaceReaction(globalCtx, 0x11) != 0) { + this->actor.textId = Text_GetFaceReaction(globalCtx, 0x11); + } + + if (func_800B84D0(&this->actor, globalCtx)) { + this->unk_2DC = this->actor.yawTowardsPlayer; + func_80C00234(this); + return; + } + + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); + + if ((this->unk_2CC <= sp2C) && (this->unk_2BC < 5)) { + this->unk_2BC++; + if (this->unk_2EC != 19) { + func_80BFE494(this, 19, 1.0f); + } + } + + if (player->transformation == PLAYER_FORM_DEKU) { + if (gSaveContext.weekEventReg[73] & 0x20) { + this->unk_2C8 = 3; + func_80BFE32C(this, globalCtx, 3); + } else { + if (!(gSaveContext.weekEventReg[77] & 2)) { + if (this->unk_2E8 == 0) { + this->unk_2C8 = 4; + } else { + this->unk_2C8 = 3; + } + } else { + this->unk_2C8 = 11; + } + func_80BFE32C(this, globalCtx, 2); + } + } else if (player->transformation == PLAYER_FORM_HUMAN) { + if (gSaveContext.weekEventReg[84] & 0x80) { + this->unk_2C8 = 0; + func_80BFE32C(this, globalCtx, 3); + } else { + if (!(gSaveContext.weekEventReg[85] & 1)) { + if (this->unk_2EA == 0) { + this->unk_2C8 = 4; + } else { + this->unk_2C8 = 3; + } + } else { + this->unk_2C8 = 11; + } + func_80BFE32C(this, globalCtx, 2); + } + } else if (this->unk_2CA != 1) { + func_80BFE32C(this, globalCtx, 1); + } + + if (this->unk_2DE != 0) { + if (this->unk_2BC >= 5) { + func_80BFE67C(this, globalCtx); + } + func_800B8614(&this->actor, globalCtx, 70.0f); + } +} + +void func_80BFF3F0(EnBomjima* this) { + func_80BFE494(this, 15, 1.0f); + this->unk_2A0 = 3; + this->actionFunc = func_80BFF430; +} + +void func_80BFF430(EnBomjima* this, GlobalContext* globalCtx) { + f32 curFrame = this->skelAnime.curFrame; + + if (this->unk_2CC <= curFrame) { + EnBombal* bombal = (EnBombal*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOMBAL, this->unk_2B0.x, + this->unk_2B0.y, this->unk_2B0.z, 0, 0, 0, 0); + + if (bombal != NULL) { + bombal->unk_150 = 0.0f; + bombal->unk_14C = this->unk_2F4; + func_800B86C8(&this->actor, globalCtx, &bombal->actor); + gSaveContext.weekEventReg[83] &= (u8)~4; + func_80BFE65C(this); + func_801477B4(globalCtx); + this->actionFunc = func_80BFEA94; + } + } +} + +void func_80BFF4F4(EnBomjima* this) { + func_80BFE65C(this); + this->unk_2A0 = 4; + this->actionFunc = func_80BFF52C; +} + +void func_80BFF52C(EnBomjima* this, GlobalContext* globalCtx) { + if ((func_80152498(&globalCtx->msgCtx) == 4) && func_80147624(globalCtx)) { + func_801477B4(globalCtx); + if (globalCtx->msgCtx.choiceIndex == 0) { + Player* player = GET_PLAYER(globalCtx); + + func_8019F208(); + func_80BFE65C(this); + this->unk_28E = 0; + this->unk_29A = 0; + this->unk_2C8 = 8; + if (player->transformation == PLAYER_FORM_DEKU) { + this->actor.textId = D_80C00A54[this->unk_2C8]; + } else { + this->actor.textId = D_80C00A70[this->unk_2C8]; + } + func_80151938(globalCtx, this->actor.textId); + play_sound(NA_SE_SY_FOUND); + func_80BFE494(this, 15, 1.0f); + this->unk_2A0 = 5; + this->actionFunc = func_80BFF6CC; + } else { + Player* player = GET_PLAYER(globalCtx); + + func_8019F230(); + func_80BFE65C(this); + this->unk_2C8 = 10; + if (player->transformation == PLAYER_FORM_DEKU) { + this->actor.textId = D_80C00A54[this->unk_2C8]; + this->unk_2E8 = 1; + } else { + this->actor.textId = D_80C00A70[this->unk_2C8]; + this->unk_2EA = 1; + } + func_80151938(globalCtx, this->actor.textId); + func_80C00234(this); + } + } +} + +void func_80BFF6CC(EnBomjima* this, GlobalContext* globalCtx) { + f32 curFrame = this->skelAnime.curFrame; + + if (this->unk_2CC <= curFrame) { + if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { + func_801477B4(globalCtx); + func_80BFE494(this, 1, 1.0f); + this->actionFunc = func_80BFF754; + } + } +} + +#ifdef NON_EQUIVALENT +// Data indexing is wrong + +typedef struct { + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk_02; +} EnBombjimaStruct; + +void func_80BFF754(EnBomjima* this, GlobalContext* globalCtx) { + static EnBombjimaStruct D_80C00AF8[] = { + { 0x4000, 0x003C }, + { 0x4000, 0x001E }, + { 0xC000, 0x001E }, + { 0xC000, 0x003C }, + }; + Player* player = GET_PLAYER(globalCtx); + Vec3f spA0; + EnBombal* temp_s3; + s32 i; + f32 x; + f32 y; + f32 z; + + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_2D4[1]); + return; + } + + if (!ActorCutscene_GetCanPlayNext(this->unk_2D4[1])) { + ActorCutscene_SetIntentToPlay(this->unk_2D4[1]); + return; + } + + for (i = 1; i < 5; i++) { + Math_Vec3f_Copy(&spA0, &player->actor.world.pos); + + x = spA0.x - this->actor.world.pos.x; + y = spA0.y - this->actor.world.pos.y; + z = spA0.z - this->actor.world.pos.z; + + spA0.x += x * (2.0f + (i * 0.2f)); + spA0.y += y * (2.0f + (i * 0.2f)); + spA0.z += z * (2.0f + (i * 0.2f)); + + temp_s3 = (EnBombal*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOMJIMA, spA0.x, + spA0.y, spA0.z, 0, 0, 0, i + 32); + if (temp_s3 != NULL) { + s32 idx1 = (i * 2) - 1; + s32 idx2 = i * 2; + + Math_Vec3f_Copy(&spA0, &this->actor.world.pos); + + spA0.x += Math_SinS(D_80C00AF8[idx1 - 1].unk_00 + this->actor.world.rot.y) * D_80C00AF8[idx2].unk_02; + spA0.z += Math_CosS(D_80C00AF8[idx2].unk_00 + this->actor.world.rot.y) * D_80C00AF8[idx2].unk_02; + + Math_Vec3f_Copy(&temp_s3->unk_2A4, &spA0); + } + } + + D_80C009F0 = 0; + ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[1], &this->actor); + this->actionFunc = func_80BFF9B0; +} +#else +static s16 D_80C00AF8[][2] = { + { 0x4000, 0x003C }, + { 0x4000, 0x001E }, + { 0xC000, 0x001E }, + { 0xC000, 0x003C }, +}; +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF754.s") #endif -extern ColliderCylinderInit D_80C00A18; +void func_80BFF9B0(EnBomjima* this, GlobalContext* globalCtx) { + if (D_80C009F0 >= 4) { + Player* player = GET_PLAYER(globalCtx); -extern UNK_TYPE D_060064B8; + D_80C009F0 = 0; + this->unk_2C8 = 9; + if (player->transformation == PLAYER_FORM_DEKU) { + gSaveContext.weekEventReg[73] |= 0x10; + gSaveContext.weekEventReg[77] |= 2; + } else { + gSaveContext.weekEventReg[85] |= 2; + gSaveContext.weekEventReg[85] |= 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/EnBomjima_Init.s") + gSaveContext.weekEventReg[11] &= (u8)~1; + gSaveContext.weekEventReg[11] &= (u8)~2; + gSaveContext.weekEventReg[11] &= (u8)~4; + gSaveContext.weekEventReg[11] &= (u8)~8; + gSaveContext.weekEventReg[11] &= (u8)~0x10; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/EnBomjima_Destroy.s") + gSaveContext.weekEventReg[76] &= (u8)~1; + gSaveContext.weekEventReg[76] &= (u8)~2; + gSaveContext.weekEventReg[76] &= (u8)~4; + gSaveContext.weekEventReg[76] &= (u8)~8; + gSaveContext.weekEventReg[76] &= (u8)~0x10; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFE32C.s") + gSaveContext.unk_FE6 = 0; + gSaveContext.unk_FE7[0] = 0; + gSaveContext.unk_FE7[1] = 0; + gSaveContext.unk_FE7[2] = 0; + gSaveContext.unk_FE7[3] = 0; + gSaveContext.unk_FE7[4] = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFE494.s") + func_80BFE494(this, 3, 1.0f); + this->unk_2C8 = 9; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFE524.s") + if (player->transformation == PLAYER_FORM_DEKU) { + this->actor.textId = D_80C00A54[this->unk_2C8]; + } else { + this->actor.textId = D_80C00A70[this->unk_2C8]; + } + func_80151938(globalCtx, this->actor.textId); + this->actionFunc = func_80BFFB40; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFE65C.s") +void func_80BFFB40(EnBomjima* this, GlobalContext* globalCtx) { + if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { + func_801477B4(globalCtx); + func_80BFE494(this, 15, 1.0f); + D_80C009F0 = 100; + this->unk_2DC = 0; + this->actionFunc = func_80BFFBC4; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFE67C.s") +void func_80BFFBC4(EnBomjima* this, GlobalContext* globalCtx) { + f32 curFrame = this->skelAnime.curFrame; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFEA94.s") + if ((this->unk_2EC != 1) && (this->unk_2CC <= curFrame)) { + func_80BFE494(this, 1, 1.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFEB1C.s") + if ((D_80C009F4 != 0) && (this->unk_2C2 == 0)) { + this->unk_2C2 = Rand_S16Offset(5, 5); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFEB64.s") + if (this->unk_2C2 == 1) { + this->unk_2DC = -10000; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFEFF0.s") + Math_SmoothStepToS(&this->unk_290, this->unk_2DC, 1, 5000, 0); + if (D_80C009F0 >= 104) { + D_80C009F0 = 0; + func_801477B4(globalCtx); + globalCtx->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); + gSaveContext.nextCutsceneIndex = 0; + globalCtx->sceneLoadFlag = 20; + globalCtx->unk_1887F = 0x56; + gSaveContext.nextTransition = 3; + ActorCutscene_Stop(this->unk_2D4[1]); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF03C.s") +void func_80BFFCFC(EnBomjima* this) { + func_80BFE65C(this); + func_80BFE494(this, 18, 1.0f); + this->unk_2A0 = 6; + this->actionFunc = func_80BFFD48; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF120.s") +void func_80BFFD48(EnBomjima* this, GlobalContext* globalCtx) { + s32 pad[2]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF174.s") + this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A4); + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); + Math_ApproachF(&this->actor.world.pos.x, this->unk_2A4.x, 0.3f, 4.0f); + Math_ApproachF(&this->actor.world.pos.z, this->unk_2A4.z, 0.3f, 4.0f); + if (sqrtf(SQ(this->actor.world.pos.x - this->unk_2A4.x) + SQ(this->actor.world.pos.z - this->unk_2A4.z)) < 4.0f) { + D_80C009F0++; + this->unk_2DC = this->actor.parent->world.rot.y; + func_80BFE494(this, 0, 1.0f); + this->actionFunc = func_80BFFE48; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF3F0.s") +void func_80BFFE48(EnBomjima* this, GlobalContext* globalCtx) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); + Math_ApproachF(&this->actor.world.pos.x, this->unk_2A4.x, 0.3f, 4.0f); + Math_ApproachF(&this->actor.world.pos.z, this->unk_2A4.z, 0.3f, 4.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF430.s") + if (D_80C009F0 >= 100) { + if (this->unk_2E4 != 4) { + func_80BFE494(this, 15, 1.0f); + this->unk_2DC = 0; + func_80BFE65C(this); + this->actionFunc = func_80BFFF54; + } else { + Math_SmoothStepToS(&this->unk_290, 10000, 1, 5000, 0); + if (D_80C009F0 >= 103) { + this->unk_2DC = 0; + func_80BFE494(this, 15, 1.0f); + func_80BFE65C(this); + this->actionFunc = func_80BFFF54; + } + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF4F4.s") +void func_80BFFF54(EnBomjima* this, GlobalContext* globalCtx) { + f32 curFrame = this->skelAnime.curFrame; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF52C.s") + Math_SmoothStepToS(&this->unk_290, this->unk_2DC, 1, 5000, 0); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF6CC.s") + if ((D_80C009F4 != 0) && (this->unk_2C2 == 0)) { + this->unk_2C2 = Rand_S16Offset(5, 5); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF754.s") + if (this->unk_2C2 == 1) { + this->unk_2DC = -10000; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFF9B0.s") + if (this->unk_2E4 != 4) { + if ((this->unk_2EC != 0) && (this->unk_2CC <= curFrame)) { + D_80C009F0++; + func_80BFE494(this, 0, 1.0f); + } + } else if ((this->unk_2EC != 8) && (this->unk_2CC <= curFrame)) { + func_80BFE494(this, 8, 1.0f); + D_80C009F4 = 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFFB40.s") + if (this->unk_2EC == 8) { + if ((D_80C009F4 == 1) && Animation_OnFrame(&this->skelAnime, 7.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_HUMAN_BOUND); + D_80C009F4 = 2; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFFBC4.s") + if ((this->unk_2CC <= curFrame) && (this->unk_2C0 == 0)) { + this->unk_2C0 = 10; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFFCFC.s") + if (this->unk_2C0 == 1) { + D_80C009F0++; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFFD48.s") +void func_80C0011C(EnBomjima* this) { + func_80BFE65C(this); + func_80BFE494(this, 0, 1.0f); + this->unk_2A0 = 7; + this->actionFunc = func_80C00168; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFFE48.s") +void func_80C00168(EnBomjima* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80BFFF54.s") + if (player->transformation == PLAYER_FORM_HUMAN) { + this->unk_2C8 = 4; + } else if (player->transformation == PLAYER_FORM_DEKU) { + this->unk_2C8 = 7; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80C0011C.s") + func_80BFE32C(this, globalCtx, 0); + func_80BFE67C(this, globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80C00168.s") + if (Text_GetFaceReaction(globalCtx, 0x11) != 0) { + this->actor.textId = Text_GetFaceReaction(globalCtx, 0x11); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80C00234.s") + if (func_800B84D0(&this->actor, globalCtx)) { + this->unk_2DC = this->actor.yawTowardsPlayer; + func_80C00234(this); + } else { + func_800B8614(&this->actor, globalCtx, 70.0f); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80C00284.s") +void func_80C00234(EnBomjima* this) { + func_80BFE494(this, 3, 1.0f); + this->collider.dim.radius = 15; + this->collider.dim.height = 40; + func_80BFE65C(this); + this->actionFunc = func_80C00284; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/EnBomjima_Update.s") +void func_80C00284(EnBomjima* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + f32 sp28 = this->skelAnime.curFrame; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/func_80C007F4.s") + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); + if (((this->unk_2A0 == 0) || (this->unk_2C8 == 10) || (this->unk_2C8 == 11) || (this->unk_2CA == 1)) && + (this->unk_2CC <= sp28)) { + if (!(this->unk_2BC & 1)) { + func_80BFE494(this, 3, 1.0f); + } else { + func_80BFE494(this, 16, 1.0f); + } + this->unk_2BC++; + this->unk_2BC &= 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bomjima/EnBomjima_Draw.s") + if ((player->transformation != PLAYER_FORM_GORON) && (player->transformation != PLAYER_FORM_ZORA)) { + if (player->transformation == PLAYER_FORM_HUMAN) { + this->unk_28E = -4000; + } + } else { + this->unk_28E = -6000; + } + + if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { + this->collider.dim.radius = 10; + this->collider.dim.height = 30; + if ((this->unk_2A0 == 4) || (this->unk_2CA == 1) || ((this->unk_2CA == 3) && (this->unk_2C8 >= 2))) { + this->unk_28E = 0; + if (player->stateFlags1 & 0x20) { + player->stateFlags1 &= ~0x20; + } + + if ((this->unk_2F0 == 0) || (this->unk_2F0->actor.update == NULL) || + (this->unk_2F0->actor.colChkInfo.health <= 0)) { + func_80BFF3F0(this); + } else { + func_80BFE65C(this); + func_801477B4(globalCtx); + this->actionFunc = func_80BFEA94; + } + return; + } + + func_801477B4(globalCtx); + + switch (this->unk_2CA) { + case 0: + this->unk_28E = 0; + if (this->unk_2A0 == 7) { + func_80C0011C(this); + } else { + func_80BFEB1C(this); + } + break; + + case 2: + if (this->unk_2C8 == 10) { + func_80BFE65C(this); + this->unk_28E = 0; + func_80BFE494(this, 1, 1.0f); + this->unk_2A0 = 2; + this->actionFunc = func_80BFF174; + return; + } + + this->unk_2C8++; + if (player->transformation == PLAYER_FORM_DEKU) { + if ((this->unk_2E8 != 0) && (this->unk_2C8 == 4)) { + this->unk_2C8 = 6; + } + this->actor.textId = D_80C00A54[this->unk_2C8]; + } else { + if ((this->unk_2EA != 0) && (this->unk_2C8 == 4)) { + this->unk_2C8 = 6; + } + this->actor.textId = D_80C00A70[this->unk_2C8]; + } + func_80151938(globalCtx, this->actor.textId); + if ((this->unk_2C8 == 7) || (this->unk_2C8 == 12)) { + func_80BFF4F4(this); + } + break; + + case 3: + this->unk_2C8++; + this->actor.textId = D_80C00A8C[this->unk_2C8]; + func_80151938(globalCtx, this->actor.textId); + if (this->unk_2C8 >= 2) { + func_80BFE494(this, 17, 1.0f); + } + break; + } + } +} + +void EnBomjima_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnBomjima* this = THIS; + + if (this->unk_2BE != 0) { + this->unk_2BE--; + } + + if (this->unk_2C2 != 0) { + this->unk_2C2--; + } + + if (this->unk_2C0 != 0) { + this->unk_2C0--; + } + + if (this->unk_2C6 != 0) { + this->unk_2C6--; + } + + if (this->unk_2C4 != 0) { + this->unk_2C4--; + } + + SkelAnime_Update(&this->skelAnime); + this->actor.shape.rot.y = this->actor.world.rot.y; + func_80BFE524(this); + Actor_SetHeight(&this->actor, 20.0f); + this->actionFunc(this, globalCtx); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + Math_SmoothStepToS(&this->unk_28A, this->unk_290, 1, 5000, 0); + Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 1000, 0); + Math_SmoothStepToS(&this->unk_294, this->unk_29A, 1, 1000, 0); + + if (this->unk_2E2 == 0) { + this->unk_2E0++; + if (this->unk_2E0 >= 3) { + this->unk_2E0 = 0; + this->unk_2E2 = (s16)Rand_ZeroFloat(60.0f) + 20; + } + } + + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); + this->actor.uncullZoneForward = 500.0f; + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); +} + +s32 EnBomjima_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + EnBomjima* this = THIS; + + if (limbIndex == 8) { + rot->z += this->unk_294; + } + + if ((limbIndex == 15) && (this->unk_2E6 == 2)) { + *dList = NULL; + } + + if (limbIndex == 17) { + rot->x += this->unk_28A; + rot->z += this->unk_288; + } + + if ((limbIndex == 19) && (this->unk_2E6 == 2)) { + *dList = NULL; + } + + if ((limbIndex == 20) && (this->unk_2E6 == 0)) { + *dList = NULL; + } + + return false; +} + +#include "overlays/ovl_En_Bomjima/ovl_En_Bomjima.c" + +void EnBomjima_Draw(Actor* thisx, GlobalContext* globalCtx) { + static Gfx* D_80C00B28[] = { + gEnBomjima_D_80C00B08, gEnBomjima_D_80C00B18, gEnBomjima_D_80C00B18, + gEnBomjima_D_80C00B18, gEnBomjima_D_80C00B18, + }; + static TexturePtr D_80C00B3C[] = { + &object_cs_Tex_00C520, + &object_cs_Tex_00CD20, + &object_cs_Tex_00D520, + }; + static TexturePtr D_80C00B48[] = { + &object_cs_Tex_00E620, &object_cs_Tex_00EA20, &object_cs_Tex_00EE20, + &object_cs_Tex_00DD20, &object_cs_Tex_00F220, + }; + EnBomjima* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + func_8012C2DC(globalCtx->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80C00B3C[this->unk_2E0])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_80C00B48[this->unk_2E4])); + gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(D_80C00B28[this->unk_2E4])); + + Scene_SetRenderModeXlu(globalCtx, 0, 1); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnBomjima_OverrideLimbDraw, NULL, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h index b24725d21..c01e70bd5 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h @@ -7,11 +7,53 @@ struct EnBomjima; typedef void (*EnBomjimaActionFunc)(struct EnBomjima*, GlobalContext*); +#define ENBOMJIMA_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) +#define ENBOMJIMA_GET_F(thisx) ((thisx)->params & 0xF) + typedef struct EnBomjima { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x140]; - /* 0x0284 */ EnBomjimaActionFunc actionFunc; - /* 0x0288 */ char unk_288[0xBC]; + /* 0x144 */ SkelAnime skelAnime; + /* 0x188 */ Vec3s jointTable[21]; + /* 0x206 */ Vec3s morphTable[21]; + /* 0x284 */ EnBomjimaActionFunc actionFunc; + /* 0x288 */ s16 unk_288; + /* 0x28A */ s16 unk_28A; + /* 0x28C */ UNK_TYPE1 unk28C[2]; + /* 0x28E */ s16 unk_28E; + /* 0x290 */ s16 unk_290; + /* 0x292 */ UNK_TYPE1 unk292[2]; + /* 0x294 */ s16 unk_294; + /* 0x296 */ UNK_TYPE1 unk296[4]; + /* 0x29A */ s16 unk_29A; + /* 0x29C */ UNK_TYPE1 unk29C[4]; + /* 0x2A0 */ s16 unk_2A0; + /* 0x2A2 */ s16 unk_2A2; + /* 0x2A4 */ Vec3f unk_2A4; + /* 0x2B0 */ Vec3f unk_2B0; + /* 0x2BC */ s16 unk_2BC; + /* 0x2BE */ s16 unk_2BE; + /* 0x2C0 */ s16 unk_2C0; + /* 0x2C2 */ s16 unk_2C2; + /* 0x2C4 */ s16 unk_2C4; + /* 0x2C6 */ s16 unk_2C6; + /* 0x2C8 */ s16 unk_2C8; + /* 0x2CA */ s16 unk_2CA; + /* 0x2CC */ f32 unk_2CC; + /* 0x2D0 */ f32 unk_2D0; + /* 0x2D4 */ s16 unk_2D4[2]; + /* 0x2D8 */ UNK_TYPE1 unk2D8[4]; // maybe a part of the above? + /* 0x2DC */ s16 unk_2DC; + /* 0x2DE */ s16 unk_2DE; + /* 0x2E0 */ s16 unk_2E0; + /* 0x2E2 */ s16 unk_2E2; + /* 0x2E4 */ s16 unk_2E4; + /* 0x2E6 */ s16 unk_2E6; + /* 0x2E8 */ s16 unk_2E8; + /* 0x2EA */ s16 unk_2EA; + /* 0x2EC */ s32 unk_2EC; + /* 0x2F0 */ EnBombal* unk_2F0; + /* 0x2F4 */ s16 unk_2F4; + /* 0x2F8 */ ColliderCylinder collider; } EnBomjima; // size = 0x344 extern const ActorInit En_Bomjima_InitVars; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index d3311877b..63674d4f4 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -16483,7 +16483,7 @@ 0x80C00234:("func_80C00234",), 0x80C00284:("func_80C00284",), 0x80C00644:("EnBomjima_Update",), - 0x80C007F4:("func_80C007F4",), + 0x80C007F4:("EnBomjima_OverrideLimbDraw",), 0x80C008B4:("EnBomjima_Draw",), 0x80C00EA0:("EnBomjimb_Init",), 0x80C01110:("EnBomjimb_Destroy",), diff --git a/undefined_syms.txt b/undefined_syms.txt index 7cf08b34f..8d8771879 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1697,7 +1697,7 @@ D_06000340 = 0x06000340; D_06000408 = 0x06000408; D_06000530 = 0x06000530; -// ovl_En_Bomjima +// ovl_En_Bomjimb D_060064B8 = 0x060064B8; D_0600F82C = 0x0600F82C;