diff --git a/assets/xml/overlays/ovl_En_Bom_Bowl_Man.xml b/assets/xml/overlays/ovl_En_Bom_Bowl_Man.xml new file mode 100644 index 0000000000..7e0b6d08b1 --- /dev/null +++ b/assets/xml/overlays/ovl_En_Bom_Bowl_Man.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/include/z64item.h b/include/z64item.h index ab0a236fae..191e5c8de6 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -299,6 +299,7 @@ typedef enum { /* 0x3C */ GI_KEY_SMALL = 0x3C, /* 0x3E */ GI_MAP = 0x3E, /* 0x3F */ GI_COMPASS, + /* 0x50 */ GI_50 = 0x50, /* 0x52 */ GI_SCALE_GOLD = 0x52, // Assumed, used in En_Fishing /* 0x59 */ GI_BOTTLE_POTION_RED = 0x59, /* 0x5B */ GI_POTION_RED = 0x5B, diff --git a/spec b/spec index 47dc5f7724..cdd379ee1a 100644 --- a/spec +++ b/spec @@ -2435,8 +2435,7 @@ beginseg name "ovl_En_Bom_Bowl_Man" compress include "build/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.o" - include "build/data/ovl_En_Bom_Bowl_Man/ovl_En_Bom_Bowl_Man.data.o" - include "build/data/ovl_En_Bom_Bowl_Man/ovl_En_Bom_Bowl_Man.reloc.o" + include "build/src/overlays/actors/ovl_En_Bom_Bowl_Man/ovl_En_Bom_Bowl_Man_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 4ec8ae2b60..c0379f33cd 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -5,8 +5,9 @@ */ #include "z_en_bom_bowl_man.h" +#include "objects/object_cs/object_cs.h" -#define FLAGS 0x00000009 +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) #define THIS ((EnBomBowlMan*)thisx) @@ -15,18 +16,27 @@ void EnBomBowlMan_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx); void EnBomBowlMan_Draw(Actor* thisx, GlobalContext* globalCtx); +void func_809C4BC4(EnBomBowlMan* this, GlobalContext* globalCtx); void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx); void func_809C51B4(EnBomBowlMan* this, GlobalContext* globalCtx); +void func_809C52B4(EnBomBowlMan* this); void func_809C5310(EnBomBowlMan* this, GlobalContext* globalCtx); +void func_809C53A4(EnBomBowlMan* this); void func_809C5408(EnBomBowlMan* this, GlobalContext* globalCtx); +void func_809C5524(EnBomBowlMan* this, GlobalContext* globalCtx); void func_809C5598(EnBomBowlMan* this, GlobalContext* globalCtx); void func_809C5738(EnBomBowlMan* this, GlobalContext* globalCtx); +void func_809C59A4(EnBomBowlMan* this, GlobalContext* globalCtx); void func_809C59F0(EnBomBowlMan* this, GlobalContext* globalCtx); void func_809C5AA4(EnBomBowlMan* this, GlobalContext* globalCtx); void func_809C5B1C(EnBomBowlMan* this, GlobalContext* globalCtx); +void func_809C5BA0(EnBomBowlMan* this); void func_809C5BF4(EnBomBowlMan* this, GlobalContext* globalCtx); -#if 0 +s32 D_809C6100 = 0; + +s32 D_809C6104 = 0; + const ActorInit En_Bom_Bowl_Man_InitVars = { ACTOR_EN_BOM_BOWL_MAN, ACTORCAT_NPC, @@ -39,56 +49,644 @@ const ActorInit En_Bom_Bowl_Man_InitVars = { (ActorFunc)EnBomBowlMan_Draw, }; -#endif +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, +}; -extern UNK_TYPE D_060064B8; +u8 D_809C6178[] = { + 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/EnBomBowlMan_Init.s") +u16 D_809C618C[] = { 0x710, 0x711, 0x715, 0x716, 0x717, 0x718 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/EnBomBowlMan_Destroy.s") +u16 D_809C6198[] = { 0x74F, 0x750, 0x751, 0x752 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C493C.s") +Vec3f D_809C61A0[] = { + { -730.0f, 200.0f, -2350.0f }, { -690.0f, 200.0f, -2350.0f }, { -650.0f, 200.0f, -2350.0f }, + { -610.0f, 200.0f, -2350.0f }, { -570.0f, 200.0f, -2350.0f }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C49CC.s") +void EnBomBowlMan_Init(Actor* thisx, GlobalContext* globalCtx) { + EnBomBowlMan* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C4B50.s") + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 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); + this->unk_2F6 = ENBOMBOWLMAN_GET_F0(&this->actor); + this->unk_2F4 = ENBOMBOWLMAN_GET_F(&this->actor); + this->actor.targetMode = 6; + Actor_SetScale(&this->actor, 0.01f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C4B6C.s") + if (this->unk_2F6 == ENBOMBOWLMAN_F0_0) { + if (this->unk_2F4 == 0) { + func_809C4BC4(this, globalCtx); + } else { + this->unk_2F4--; + func_809C5BA0(this); + } + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C4BC4.s") + this->unk_29A = ENBOMBOWLMAN_GET_FF00(&this->actor); + this->path = func_8013D648(globalCtx, this->unk_29A, 0x3F); + this->unk_2C8 = 80.0f; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C4DA4.s") + if ((gSaveContext.entranceIndex == 0xD220) && (gSaveContext.weekEventReg[73] & 0x80) && + !CHECK_QUEST_ITEM(ITEM_BOTTLE)) { + this->unk_2D6 = this->actor.cutscene; + if (this->unk_2D6 == 0) { + Actor_MarkForDeath(&this->actor); + } + func_809C52B4(this); + } else { + Actor_MarkForDeath(&this->actor); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C51B4.s") +void EnBomBowlMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C52B4.s") +void func_809C493C(EnBomBowlMan* this, s32 arg1, f32 arg2) { + this->unk_2F8 = arg1; + this->unk_2C4 = Animation_GetLastFrame(sAnimations[arg1]); + Animation_Change(&this->skelAnime, sAnimations[this->unk_2F8], arg2, 0.0f, this->unk_2C4, D_809C6178[this->unk_2F8], + -4.0f); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5310.s") +void func_809C49CC(EnBomBowlMan* this) { + if ((this->unk_2F8 == 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))) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C53A4.s") + if ((this->unk_2F8 == 0xB) && + (Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 8.0f) || + Animation_OnFrame(&this->skelAnime, 12.0f))) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5408.s") + if ((this->unk_2F8 == 0x12) && + (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || + Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5524.s") + if ((this->unk_2F8 == 0xF) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5598.s") + if ((this->unk_2F8 == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5738.s") +void func_809C4B50(EnBomBowlMan* this) { + this->unk_2B8 = 0; + this->unk_2BC = 0; + this->unk_2BA = 0; + this->unk_29E = 0; + this->unk_290 = 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C59A4.s") +void func_809C4B6C(EnBomBowlMan* this) { + if ((this->unk_29A != ENBOMBOWLMAN_FF00_MINUS1) && (this->path != NULL)) { + if (!func_8013D68C(this->path, this->unk_298, &this->unk_2A0)) { + Actor_MarkForDeath(&this->actor); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C59F0.s") +void func_809C4BC4(EnBomBowlMan* this, GlobalContext* globalCtx) { + s32 pad; + s32 i; + Vec3f sp7C; + EnBomBowlMan* bomBowlMan; + s8 code; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5AA4.s") + func_809C4B50(this); + func_809C493C(this, 0, 1.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5B1C.s") + for (i = 0; i < ARRAY_COUNT(gSaveContext.bomberCode); i++) { + Math_Vec3f_Copy(&sp7C, &this->actor.home.pos); + code = gSaveContext.bomberCode[i]; + if (code == 1) { + Math_Vec3f_Copy(&this->actor.world.pos, &D_809C61A0[i]); + this->unk_2D8[code] = this; + } else { + Math_Vec3f_Copy(&sp7C, &D_809C61A0[i]); + bomBowlMan = + (EnBomBowlMan*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_BOM_BOWL_MAN, + sp7C.x, sp7C.y, sp7C.z, 0, this->actor.world.rot.y, 0, code); + if (bomBowlMan != NULL) { + if (i == 2) { + this->unk_2D8[0] = bomBowlMan; + } + this->unk_2D8[code] = bomBowlMan; + } + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5BA0.s") + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_2D0); + } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D0)) { + ActorCutscene_SetIntentToPlay(this->unk_2D0); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5BF4.s") + func_809C493C(this, 3, 1.0f); + this->unk_2D4 = this->actor.yawTowardsPlayer; + this->unk_290 = this->actor.yawTowardsPlayer; + gSaveContext.weekEventReg[73] &= (u8)~0x10; + gSaveContext.weekEventReg[85] &= (u8)~2; + this->unk_29C = 0; + this->actionFunc = func_809C4DA4; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/EnBomBowlMan_Update.s") +void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx) { + Math_SmoothStepToS(&this->unk_290, this->unk_2D4, 1, 5000, 0); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/func_809C5F44.s") + if (this->unk_2B8 == 0) { + Player* player = GET_PLAYER(globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bom_Bowl_Man/EnBomBowlMan_Draw.s") + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_2D0); + return; + } + + if (!ActorCutscene_GetCanPlayNext(this->unk_2D0)) { + ActorCutscene_SetIntentToPlay(this->unk_2D0); + return; + } + + ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D0, &this->actor); + this->unk_2B8 = 1; + this->unk_2C0 = 0; + this->unk_2D4 = this->actor.yawTowardsPlayer; + this->unk_290 = this->actor.yawTowardsPlayer; + if (player->transformation == PLAYER_FORM_HUMAN) { + func_801518B0(globalCtx, D_809C618C[0], &this->actor); + } else { + func_801518B0(globalCtx, D_809C6198[0], &this->actor); + } + } + + if ((this->unk_2BC == 0) && (Message_GetState(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { + Player* player = GET_PLAYER(globalCtx); + s32 pad; + s32 sp28 = false; + + func_801477B4(globalCtx); + + switch (this->unk_2C0) { + case 0: + this->unk_2C0 = 1; + D_809C6104 = 1; + func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->unk_2D0)), + &this->unk_2D8[0]->actor); + this->unk_2D4 = 0; + this->unk_2BC = 10; + func_809C493C(this, 17, 1.0f); + break; + + case 1: + D_809C6104 = 0; + func_809C493C(this, 3, 1.0f); + this->unk_2D4 = this->actor.yawTowardsPlayer; + this->unk_2C0 = 2; + if ((player->transformation == PLAYER_FORM_HUMAN) && CHECK_QUEST_ITEM(ITEM_BOTTLE)) { + this->unk_2C0 = 4; + } + break; + + case 2: + if (player->transformation == PLAYER_FORM_HUMAN) { + this->unk_2B8 = 2; + ActorCutscene_Stop(this->unk_2D0); + func_809C59A4(this, globalCtx); + sp28 = true; + } else { + this->unk_2C0 = 3; + globalCtx->msgCtx.unk11F10 = 0; + func_809C493C(this, 1, 1.0f); + D_809C6100 = 1; + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_2D2); + } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D2)) { + ActorCutscene_SetIntentToPlay(this->unk_2D2); + } + ActorCutscene_Stop(this->unk_2D0); + this->actionFunc = func_809C5B1C; + sp28 = true; + } + break; + + case 3: + if (player->transformation == PLAYER_FORM_HUMAN) { + this->unk_2C0 = 4; + } else { + this->actionFunc = func_809C51B4; + return; + } + break; + + case 4: + if (this->unk_2B8 != 2) { + ActorCutscene_Stop(this->unk_2D0); + } + globalCtx->msgCtx.unk11F10 = 0; + func_809C493C(this, 1, 1.0f); + D_809C6100 = 1; + this->actionFunc = func_809C5B1C; + sp28 = true; + break; + + case 5: + func_80151BB4(globalCtx, 0x24); + func_80151BB4(globalCtx, 0x25); + func_80151BB4(globalCtx, 0); + this->actionFunc = func_809C51B4; + sp28 = true; + break; + } + + if (!sp28) { + if (player->transformation == PLAYER_FORM_HUMAN) { + func_80151938(globalCtx, D_809C618C[this->unk_2C0]); + } else { + func_80151938(globalCtx, D_809C6198[this->unk_2C0]); + } + } + } +} + +void func_809C51B4(EnBomBowlMan* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if ((globalCtx->msgCtx.unk120B1 == 0) && + ((globalCtx->msgCtx.msgMode == 0) || (Message_GetState(&globalCtx->msgCtx) == 6))) { + globalCtx->nextEntranceIndex = Entrance_CreateIndexFromSpawn(6); + gSaveContext.nextCutsceneIndex = 0; + globalCtx->sceneLoadFlag = 0x14; + globalCtx->unk_1887F = 0x56; + gSaveContext.nextTransition = 3; + gSaveContext.weekEventReg[75] &= (u8)~0x40; + if (player->transformation == PLAYER_FORM_HUMAN) { + gSaveContext.weekEventReg[84] |= 0x80; + gSaveContext.weekEventReg[77] &= (u8)~2; + } else { + gSaveContext.weekEventReg[73] |= 0x20; + gSaveContext.weekEventReg[85] &= (u8)~1; + } + } +} + +void func_809C52B4(EnBomBowlMan* this) { + this->actor.draw = NULL; + this->actor.flags |= ACTOR_FLAG_10; + this->actor.flags |= ACTOR_FLAG_8000000; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.world.pos.x = 1340.0f; + this->actor.world.pos.z = -1795.0f; + this->unk_29C = 3; + this->actionFunc = func_809C5310; +} + +void func_809C5310(EnBomBowlMan* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (player->actor.world.pos.x < 1510.0f) { + if (player->transformation != PLAYER_FORM_DEKU) { + if (this->actor.xzDistToPlayer < this->unk_2C8) { + func_800B7298(globalCtx, &this->actor, 7); + func_809C53A4(this); + } + } else { + Actor_MarkForDeath(&this->actor); + } + } +} + +void func_809C53A4(EnBomBowlMan* this) { + this->actor.draw = EnBomBowlMan_Draw; + this->actor.world.pos.x = 1360.0f; + this->actor.world.pos.z = -1870.0f; + func_809C493C(this, 18, 1.0f); + this->unk_29C = 3; + this->actionFunc = func_809C5408; +} + +void func_809C5408(EnBomBowlMan* this, GlobalContext* globalCtx) { + s32 pad[2]; + Player* player = GET_PLAYER(globalCtx); + + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &player->actor.world.pos), 1, + 0x1388, 0); + Math_SmoothStepToS(&player->actor.shape.rot.y, Math_Vec3f_Yaw(&player->actor.world.pos, &this->actor.world.pos), 1, + 0x1388, 0); + player->actor.world.rot.y = player->actor.shape.rot.y; + Math_ApproachF(&this->actor.world.pos.x, 1350.0f, 0.3f, 2.0f); + Math_ApproachF(&this->actor.world.pos.z, -1800.0f, 0.3f, 2.0f); + if (sqrtf(SQ(this->actor.world.pos.x - 1350.0f) + SQ(this->actor.world.pos.z + 1800.0f)) < 4.0f) { + func_809C5524(this, globalCtx); + } +} + +void func_809C5524(EnBomBowlMan* this, GlobalContext* globalCtx) { + this->actor.textId = 0x730; + if (!(gSaveContext.weekEventReg[85] & 2)) { + this->actor.textId = 0x72F; + } + func_809C493C(this, 3, 1.0f); + func_801518B0(globalCtx, this->actor.textId, &this->actor); + this->actionFunc = func_809C5598; +} + +void func_809C5598(EnBomBowlMan* this, GlobalContext* globalCtx) { + if ((Message_GetState(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { + func_801477B4(globalCtx); + if ((this->actor.textId == 0x72F) || (this->actor.textId == 0x730)) { + this->actor.textId = 0x731; + } else if (this->actor.textId == 0x731) { + this->actor.textId = 0x732; + } else if (this->actor.textId == 0x732) { + this->actor.textId = 0x733; + } else if (this->actor.textId == 0x733) { + this->actor.textId = 0x734; + } else if (this->actor.textId == 0x734) { + this->actor.textId = 0x715; + } else if (this->actor.textId == 0x715) { + func_800B7298(globalCtx, &this->actor, 6); + func_809C493C(this, 17, 1.0f); + func_809C59A4(this, globalCtx); + return; + } else if (this->actor.textId == 0x716) { + this->actor.textId = 0x735; + } else if (this->actor.textId == 0x735) { + this->unk_2C2 = 0; + func_809C493C(this, 17, 1.0f); + func_80151BB4(globalCtx, 0x24); + func_80151BB4(globalCtx, 0x25); + func_80151BB4(globalCtx, 0); + func_800B7298(globalCtx, &this->actor, 7); + this->actionFunc = func_809C5738; + return; + } + func_80151938(globalCtx, this->actor.textId); + } +} + +void func_809C5738(EnBomBowlMan* this, GlobalContext* globalCtx) { + s32 pad[3]; + s16 yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A0); + + if (this->unk_2C2 == 0) { + if ((globalCtx->msgCtx.unk120B1 == 0) && + ((globalCtx->msgCtx.msgMode == 0) || (Message_GetState(&globalCtx->msgCtx) == 6))) { + this->unk_2C2 = 1; + func_809C4B6C(this); + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_2D6); + } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D6)) { + ActorCutscene_SetIntentToPlay(this->unk_2D6); + } else { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D6, &this->actor); + this->unk_2C2 = 2; + func_809C493C(this, 18, 1.0f); + } + } + } else if (this->unk_2C2 == 1) { + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_2D6); + } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D6)) { + ActorCutscene_SetIntentToPlay(this->unk_2D6); + } else { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D6, &this->actor); + this->unk_2C2 = 2; + func_809C493C(this, 18, 1.0f); + } + } else { + Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 2000, 10); + Math_ApproachF(&this->actor.world.pos.x, this->unk_2A0.x, 0.5f, 6.0f); + Math_ApproachF(&this->actor.world.pos.z, this->unk_2A0.z, 0.5f, 6.0f); + if ((sqrtf(SQ(this->actor.world.pos.x - this->unk_2A0.x) + SQ(this->actor.world.pos.z - this->unk_2A0.z)) < + 4.0f) && + (this->path != NULL)) { + this->unk_298++; + if (this->unk_298 >= this->path->count) { + gSaveContext.weekEventReg[84] |= 0x80; + gSaveContext.weekEventReg[83] &= (u8)~4; + ActorCutscene_Stop(this->unk_2D6); + Actor_MarkForDeath(&this->actor); + } else { + func_809C4B6C(this); + } + } + } +} + +void func_809C59A4(EnBomBowlMan* this, GlobalContext* globalCtx) { + Actor_PickUp(&this->actor, globalCtx, GI_50, 300.0f, 300.0f); + this->unk_29C = 1; + this->actionFunc = func_809C59F0; +} + +void func_809C59F0(EnBomBowlMan* this, GlobalContext* globalCtx) { + if (Actor_HasParent(&this->actor, globalCtx)) { + this->actor.parent = NULL; + if (this->unk_2F6 == ENBOMBOWLMAN_F0_0) { + this->unk_2C0 = 3; + this->actor.textId = D_809C618C[this->unk_2C0]; + } else { + this->actor.textId = 0x716; + } + func_800B8500(&this->actor, globalCtx, 400.0f, 400.0f, -1); + this->actionFunc = func_809C5AA4; + } else { + Actor_PickUp(&this->actor, globalCtx, GI_50, 300.0f, 300.0f); + } +} + +void func_809C5AA4(EnBomBowlMan* this, GlobalContext* globalCtx) { + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + if (this->unk_2F6 == ENBOMBOWLMAN_F0_0) { + this->actionFunc = func_809C4DA4; + } else { + this->actionFunc = func_809C5598; + } + } else { + func_800B8500(&this->actor, globalCtx, 400.0f, 400.0f, -1); + } +} + +void func_809C5B1C(EnBomBowlMan* this, GlobalContext* globalCtx) { + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->unk_2D2); + } else if (!ActorCutscene_GetCanPlayNext(this->unk_2D2)) { + ActorCutscene_SetIntentToPlay(this->unk_2D2); + } else { + ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D2, &this->actor); + func_809C5BA0(this); + } +} + +void func_809C5BA0(EnBomBowlMan* this) { + if (this->unk_2F4 != 0) { + func_809C493C(this, 0, 1.0f); + } else { + this->unk_2F8 = 0; + } + this->unk_29C = 2; + this->actionFunc = func_809C5BF4; +} + +void func_809C5BF4(EnBomBowlMan* this, GlobalContext* globalCtx) { + f32 sp2C = this->skelAnime.curFrame; + s32 sp28; + + if ((D_809C6104 != 0) && (this->unk_2F8 != 15)) { + func_809C493C(this, 15, 1.0f); + } + + if ((this->unk_2F8 == 15) && (this->unk_2C4 <= sp2C)) { + func_809C493C(this, 0, 1.0f); + } + + if (D_809C6100 != 0) { + if ((this->unk_2F8 == 0) && (D_809C6100 == (this->unk_2F4 + 1))) { + func_809C493C(this, 11, 1.0f); + } + + if ((this->unk_2F8 == 11) && (this->unk_2C4 <= sp2C)) { + func_809C493C(this, 12, 1.0f); + D_809C6100++; + } + + if (this->unk_2F4 == 0) { + sp28 = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->unk_2D2)); + + if (D_809C6100 > 5) { + Player* player = GET_PLAYER(globalCtx); + + func_801477B4(globalCtx); + func_800E0308(sp28, &this->unk_2D8[0]->actor); + func_809C493C(this, 13, 1.0f); + D_809C6100 = 0; + if (player->transformation == PLAYER_FORM_HUMAN) { + this->unk_2C0 = 5; + func_801518B0(globalCtx, D_809C618C[this->unk_2C0], &this->actor); + } else { + this->unk_2C0 = 3; + func_801518B0(globalCtx, D_809C6198[this->unk_2C0], &this->actor); + } + this->unk_29C = 0; + this->actionFunc = func_809C4DA4; + } else { + s32 idx = D_809C6100 - 1; + + func_800E0308(sp28, &this->unk_2D8[1 + idx]->actor); + } + } + } +} + +void EnBomBowlMan_Update(Actor* thisx, GlobalContext* globalCtx) { + EnBomBowlMan* this = THIS; + + if (this->unk_2BA != 0) { + this->unk_2BA--; + } + + if (this->unk_2BC != 0) { + this->unk_2BC--; + } + + SkelAnime_Update(&this->skelAnime); + this->actor.shape.rot.y = this->actor.world.rot.y; + func_809C49CC(this); + Actor_SetFocus(&this->actor, 20.0f); + + this->actionFunc(this, globalCtx); + + Actor_MoveWithGravity(&this->actor); + Math_SmoothStepToS(&this->unk_28A, this->unk_290, 1, 0x1388, 0); + Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 0x3E8, 0); + + if (this->unk_2F2 == 0) { + this->unk_2F0++; + if (this->unk_2F0 >= 3) { + this->unk_2F0 = 0; + this->unk_2F2 = (s32)Rand_ZeroFloat(60.0f) + 20; + } + } + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 50.0f, 0x1D); +} + +s32 EnBomBowlMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + EnBomBowlMan* this = THIS; + + if (limbIndex == 15) { + *dList = NULL; + } + + if (limbIndex == 17) { + rot->x += this->unk_28A; + } + + if ((limbIndex == 19) && (this->unk_2F6 == ENBOMBOWLMAN_F0_2)) { + *dList = NULL; + } + + if ((limbIndex == 20) && (this->unk_2F6 == ENBOMBOWLMAN_F0_0)) { + *dList = NULL; + } + return false; +} + +#include "overlays/ovl_En_Bom_Bowl_Man/ovl_En_Bom_Bowl_Man.c" + +TexturePtr D_809C6200[] = { + gEnBomBowlMan_D_809C61E0, gEnBomBowlMan_D_809C61F0, gEnBomBowlMan_D_809C61F0, + gEnBomBowlMan_D_809C61F0, gEnBomBowlMan_D_809C61F0, +}; + +TexturePtr D_809C6214[] = { + object_cs_Tex_00C520, + object_cs_Tex_00CD20, + object_cs_Tex_00D520, +}; + +TexturePtr D_809C6220[] = { + object_cs_Tex_00E620, object_cs_Tex_00EA20, object_cs_Tex_00EE20, object_cs_Tex_00DD20, object_cs_Tex_00F220, +}; + +void EnBomBowlMan_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnBomBowlMan* 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_809C6214[this->unk_2F0])); + gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_809C6220[this->unk_2F4])); + gSPSegment(POLY_OPA_DISP++, 0x0A, Lib_SegmentedToVirtual(D_809C6200[this->unk_2F4])); + + Scene_SetRenderModeXlu(globalCtx, 0, 1); + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnBomBowlMan_OverrideLimbDraw, NULL, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index ba90b19c9c..21e25b19de 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -7,11 +7,54 @@ struct EnBomBowlMan; typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, GlobalContext*); +#define ENBOMBOWLMAN_GET_F(thisx) ((thisx)->params & 0xF) +#define ENBOMBOWLMAN_GET_F0(thisx) (((thisx)->params >> 4) & 0xF) +#define ENBOMBOWLMAN_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) + +#define ENBOMBOWLMAN_F0_0 0 +#define ENBOMBOWLMAN_F0_2 2 + +#define ENBOMBOWLMAN_FF00_MINUS1 -1 + typedef struct EnBomBowlMan { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x140]; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ Vec3s jointTable[21]; + /* 0x0206 */ Vec3s morphTable[21]; /* 0x0284 */ EnBomBowlManActionFunc actionFunc; - /* 0x0288 */ char unk_288[0x74]; + /* 0x0288 */ s16 unk_288; + /* 0x028A */ s16 unk_28A; + /* 0x028C */ UNK_TYPE1 unk28C[2]; + /* 0x028E */ s16 unk_28E; + /* 0x0290 */ s16 unk_290; + /* 0x0292 */ UNK_TYPE1 unk292[2]; + /* 0x0294 */ Path* path; + /* 0x0298 */ s16 unk_298; + /* 0x029A */ s16 unk_29A; + /* 0x029C */ s16 unk_29C; + /* 0x029E */ s16 unk_29E; + /* 0x02A0 */ Vec3f unk_2A0; + /* 0x02AC */ UNK_TYPE1 unk2AC[0xC]; + /* 0x02B8 */ s16 unk_2B8; + /* 0x02BA */ s16 unk_2BA; + /* 0x02BC */ s16 unk_2BC; + /* 0x02BE */ UNK_TYPE1 unk2BE[2]; + /* 0x02C0 */ s16 unk_2C0; + /* 0x02C2 */ s16 unk_2C2; + /* 0x02C4 */ f32 unk_2C4; + /* 0x02C8 */ f32 unk_2C8; + /* 0x02CC */ UNK_TYPE1 unk2CC[4]; + /* 0x02D0 */ s16 unk_2D0; + /* 0x02D2 */ s16 unk_2D2; + /* 0x02D4 */ s16 unk_2D4; + /* 0x02D6 */ s16 unk_2D6; + /* 0x02D8 */ struct EnBomBowlMan* unk_2D8[5]; + /* 0x02EC */ UNK_TYPE1 unk2EC[0x4]; + /* 0x02F0 */ s16 unk_2F0; + /* 0x02F2 */ s16 unk_2F2; + /* 0x02F4 */ s16 unk_2F4; + /* 0x02F6 */ s16 unk_2F6; + /* 0x02F8 */ s32 unk_2F8; } EnBomBowlMan; // size = 0x2FC extern const ActorInit En_Bom_Bowl_Man_InitVars; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 8766dec906..58bfc428f1 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -9078,7 +9078,7 @@ 0x809C5BA0:("func_809C5BA0",), 0x809C5BF4:("func_809C5BF4",), 0x809C5E14:("EnBomBowlMan_Update",), - 0x809C5F44:("func_809C5F44",), + 0x809C5F44:("EnBomBowlMan_OverrideLimbDraw",), 0x809C5FC4:("EnBomBowlMan_Draw",), 0x809C64C0:("func_809C64C0",), 0x809C6578:("EnSyatekiMan_Init",), diff --git a/undefined_syms.txt b/undefined_syms.txt index a3426f5770..9958b0ea44 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1210,11 +1210,6 @@ D_06000530 = 0x06000530; D_060064B8 = 0x060064B8; D_0600F82C = 0x0600F82C; -// ovl_En_Bom_Bowl_Man - -D_060064B8 = 0x060064B8; -D_0600F82C = 0x0600F82C; - // ovl_En_Box D_0600043C = 0x0600043C;