From 362a73a017fe353e09feb9a8592a05f07f7cdb91 Mon Sep 17 00:00:00 2001 From: SonicDcer <96613413+sonicdcer@users.noreply.github.com> Date: Tue, 4 Oct 2022 00:36:12 -0300 Subject: [PATCH] ovl_En_Bombal OK (#1051) * ovl_En_Bombal OK * alpha * decimal values for weekEventReg * pr review * cutscenes * merge fix * pr review --- assets/xml/objects/object_fusen.xml | 4 +- spec | 3 +- .../actors/ovl_En_Bombal/z_en_bombal.c | 246 ++++++++++++++++-- .../actors/ovl_En_Bombal/z_en_bombal.h | 28 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 150 ++++++----- .../actors/ovl_En_Bomjima/z_en_bomjima.h | 16 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 6 +- tools/disasm/functions.txt | 6 +- 8 files changed, 346 insertions(+), 113 deletions(-) diff --git a/assets/xml/objects/object_fusen.xml b/assets/xml/objects/object_fusen.xml index 0ff9e9f6c1..2e115b2b73 100644 --- a/assets/xml/objects/object_fusen.xml +++ b/assets/xml/objects/object_fusen.xml @@ -1,7 +1,7 @@  - - + + diff --git a/spec b/spec index 100e615cf1..42bbff1820 100644 --- a/spec +++ b/spec @@ -4769,8 +4769,7 @@ beginseg name "ovl_En_Bombal" compress include "build/src/overlays/actors/ovl_En_Bombal/z_en_bombal.o" - include "build/data/ovl_En_Bombal/ovl_En_Bombal.data.o" - include "build/data/ovl_En_Bombal/ovl_En_Bombal.reloc.o" + include "build/src/overlays/actors/ovl_En_Bombal/ovl_En_Bombal_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c index b4ebb73e6d..a4fc5d484f 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.c @@ -5,6 +5,8 @@ */ #include "z_en_bombal.h" +#include "assets/objects/object_fusen/object_fusen.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10) @@ -18,8 +20,11 @@ void EnBombal_Draw(Actor* thisx, PlayState* play); void func_80C05B3C(EnBombal* this, PlayState* play); void func_80C05C44(EnBombal* this, PlayState* play); void func_80C05DE8(EnBombal* this, PlayState* play); +void func_80C05B24(EnBombal* this); +void EnBombal_InitEffects(EnBombal* this, Vec3f* pos, s16 fadeDelay); +void EnBombal_UpdateEffects(EnBombal* this, PlayState* play); +void EnBombal_DrawEffects(EnBombal*, PlayState*); -#if 0 const ActorInit En_Bombal_InitVars = { ACTOR_EN_BOMBAL, ACTORCAT_PROP, @@ -32,37 +37,240 @@ const ActorInit En_Bombal_InitVars = { (ActorFunc)EnBombal_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80C06460 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x004138B0, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x004138B0, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_NONE, + }, { 60, 90, -50, { 0, 0, 0 } }, }; -#endif +void EnBombal_Init(Actor* thisx, PlayState* play) { + EnBombal* this = THIS; -extern ColliderCylinderInit D_80C06460; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); + this->actor.colChkInfo.mass = 0; + Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->actor.targetMode = 6; + this->actor.colChkInfo.health = 1; + this->scale = 0.1f; + this->cutscene = this->actor.cutscene; + func_80C05B24(this); +} -extern UNK_TYPE D_06000A00; +void EnBombal_Destroy(Actor* thisx, PlayState* play) { + EnBombal* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Init.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Destroy.s") +void func_80C05B24(EnBombal* this) { + this->isPopped = false; + this->actionFunc = func_80C05B3C; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05B24.s") +void func_80C05B3C(EnBombal* this, PlayState* play) { + Player* player; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05B3C.s") + this->oscillationAngle += 1500.0f; + this->actor.velocity.y = Math_SinS(this->oscillationAngle); + Math_ApproachF(&this->scale, 0.1f, 0.3f, 0.01f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05C44.s") + if (play->msgCtx.msgLength == 0) { + if (this->collider.base.acFlags & AC_HIT) { + player = GET_PLAYER(play); + this->collider.base.acFlags &= ~AC_HIT; + if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) && + !(gSaveContext.save.weekEventReg[85] & 2)) { + player->stateFlags1 |= ACTOR_FLAG_20; + this->actor.flags |= ACTOR_FLAG_100000; + } + this->actionFunc = func_80C05C44; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05DE8.s") +void func_80C05C44(EnBombal* this, PlayState* play) { + s32 phi_s0 = false; + s32 i; + Vec3f pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Update.s") + if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) && + !(gSaveContext.save.weekEventReg[85] & 2)) { + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + ActorCutscene_SetIntentToPlay(this->cutscene); + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Draw.s") + if (!ActorCutscene_GetCanPlayNext(this->cutscene)) { + ActorCutscene_SetIntentToPlay(this->cutscene); + } else { + ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor); + phi_s0 = true; + } + } else { + phi_s0 = true; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05F90.s") + if (phi_s0) { + Math_Vec3f_Copy(&pos, &this->actor.world.pos); + pos.y += 60.0f; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, pos.x, pos.y, pos.z, 255, 255, 200, + CLEAR_TAG_LARGE_EXPLOSION); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C060B8.s") + for (i = 0; i < 100; i++) { + EnBombal_InitEffects(this, &pos, 10); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C06208.s") + gSaveContext.save.weekEventReg[83] |= 4; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MUJURA_BALLOON_BROKEN); + this->timer = 30; + this->isPopped = true; + this->actionFunc = func_80C05DE8; + } +} + +void func_80C05DE8(EnBombal* this, PlayState* play) { + if (this->timer == 0) { + if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) && + !(gSaveContext.save.weekEventReg[85] & 2)) { + ActorCutscene_Stop(this->cutscene); + } + Actor_MarkForDeath(&this->actor); + } else if (this->timer < 10) { + this->actor.colChkInfo.health = 0; + } +} + +void EnBombal_Update(Actor* thisx, PlayState* play) { + s32 pad; + EnBombal* this = THIS; + + if (this->timer != 0) { + this->timer--; + } + + this->actor.shape.rot.y = this->actor.world.rot.y; + + Actor_SetFocus(&this->actor, 30.0f); + Actor_SetScale(&this->actor, this->scale); + + this->actionFunc(this, play); + + Actor_MoveWithGravity(&this->actor); + EnBombal_UpdateEffects(this, play); + + if (!this->isPopped) { + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } +} + +void EnBombal_Draw(Actor* thisx, PlayState* play) { + EnBombal* this = THIS; + + if (this->isPopped != true) { + Gfx_DrawDListOpa(play, gMajoraBalloonDL); + Gfx_DrawDListOpa(play, gMajoraBalloonKnotDL); + } + EnBombal_DrawEffects(this, play); +} + +void EnBombal_InitEffects(EnBombal* this, Vec3f* pos, s16 fadeDelay) { + s16 i; + EnBombalEffect* sPtr = this->effects; + + for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { + if (!sPtr->isEnabled) { + sPtr->isEnabled = true; + sPtr->pos = *pos; + sPtr->alphaFadeDelay = fadeDelay; + sPtr->alpha = 255; + + sPtr->accel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; + sPtr->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f; + sPtr->accel.z = (Rand_ZeroOne() - 0.5f) * 10.0f; + + sPtr->velocity.x = Rand_ZeroOne() - 0.5f; + sPtr->velocity.y = Rand_ZeroOne() - 0.5f; + sPtr->velocity.z = Rand_ZeroOne() - 0.5f; + + sPtr->scale = (Rand_ZeroFloat(1.0f) * 0.5f) + 2.0f; + return; + } + } +} + +void EnBombal_UpdateEffects(EnBombal* this, PlayState* play) { + s32 i; + EnBombalEffect* sPtr = this->effects; + + for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { + if (sPtr->isEnabled) { + sPtr->pos.x += sPtr->velocity.x; + sPtr->pos.y += sPtr->velocity.y; + sPtr->pos.z += sPtr->velocity.z; + sPtr->velocity.x += sPtr->accel.x; + sPtr->velocity.y += sPtr->accel.y; + sPtr->velocity.z += sPtr->accel.z; + + if (sPtr->alphaFadeDelay != 0) { + sPtr->alphaFadeDelay--; + } else { + sPtr->alpha -= 10; + if (sPtr->alpha < 10) { + sPtr->isEnabled = 0; + } + } + } + } +} + +void EnBombal_DrawEffects(EnBombal* this, PlayState* play) { + s16 i; + GraphicsContext* gfxCtx = play->state.gfxCtx; + EnBombalEffect* sPtr = this->effects; + + OPEN_DISPS(gfxCtx); + + func_8012C28C(gfxCtx); + func_8012C2DC(play->state.gfxCtx); + + for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) { + if (sPtr->isEnabled != 0) { + Matrix_Translate(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW); + Matrix_Scale(sPtr->scale, sPtr->scale, sPtr->scale, MTXMODE_APPLY); + + POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); + + gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(&gSun1Tex)); + + gSPDisplayList(POLY_XLU_DISP++, &gSunSparkleMaterialDL); + + gDPPipeSync(POLY_XLU_DISP++); + + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha); + + Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY); + Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, &gSunSparkleModelDL); + } + } + CLOSE_DISPS(gfxCtx); +} 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 5731208a40..a678fe1d8c 100644 --- a/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h +++ b/src/overlays/actors/ovl_En_Bombal/z_en_bombal.h @@ -7,15 +7,27 @@ struct EnBombal; typedef void (*EnBombalActionFunc)(struct EnBombal*, PlayState*); +typedef struct EnBombalEffect { + /* 0x00 */ u8 isEnabled; + /* 0x04 */ Vec3f pos; + /* 0x10 */ UNK_TYPE4 unk10; + /* 0x14 */ s16 alpha; + /* 0x16 */ s16 alphaFadeDelay; + /* 0x18 */ Vec3f velocity; + /* 0x24 */ Vec3f accel; + /* 0x30 */ f32 scale; +} EnBombalEffect; + typedef struct EnBombal { - /* 0x0000 */ Actor actor; - /* 0x0144 */ EnBombalActionFunc actionFunc; - /* 0x0148 */ char unk148[0x4]; - /* 0x014C */ s16 unk_14C; - /* 0x0150 */ f32 unk_150; - /* 0x0154 */ char unk154[0x150]; - /* 0x02A4 */ Vec3f unk_2A4; - /* 0x02B0 */ char unk2B0[0x2794]; + /* 0x000 */ Actor actor; + /* 0x144 */ EnBombalActionFunc actionFunc; + /* 0x148 */ s16 timer; + /* 0x14A */ s16 isPopped; + /* 0x14C */ s16 cutscene; + /* 0x150 */ f32 scale; + /* 0x154 */ f32 oscillationAngle; + /* 0x158 */ ColliderCylinder collider; + /* 0x1A4 */ EnBombalEffect effects[200]; } 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 6c5a6f235f..48b953ffed 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -39,6 +39,17 @@ void func_80C00168(EnBomjima* this, PlayState* play); void func_80C00234(EnBomjima* this); void func_80C00284(EnBomjima* this, PlayState* play); +typedef enum EN_BOMJIMA_ACTION { + /* 0 */ EN_BOMJIMA_ACTION_0, + /* 1 */ EN_BOMJIMA_ACTION_1, + /* 2 */ EN_BOMJIMA_ACTION_2, + /* 3 */ EN_BOMJIMA_ACTION_3, + /* 4 */ EN_BOMJIMA_ACTION_4, + /* 5 */ EN_BOMJIMA_ACTION_5, + /* 6 */ EN_BOMJIMA_ACTION_6, + /* 7 */ EN_BOMJIMA_ACTION_7, +} EN_BOMJIMA_ACTION; + static s32 D_80C009F0 = 0; static s32 D_80C009F4 = 0; @@ -129,7 +140,7 @@ void EnBomjima_Init(Actor* thisx, PlayState* play) { while (cs != -1) { // clang-format off - this->unk_2D4[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); + this->cutscenes[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs); // clang-format on i++; } @@ -197,31 +208,31 @@ void func_80BFE32C(EnBomjima* this, PlayState* play, s32 arg2) { } } -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_80BFE494(EnBomjima* this, s32 animIndex, f32 playSpeed) { + this->animIndex = animIndex; + this->animLastFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animLastFrame, + D_80C00AE4[this->animIndex], -4.0f); } void func_80BFE524(EnBomjima* this) { - if ((this->unk_2EC == 5) && + if ((this->animIndex == 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); } - if ((this->unk_2EC == 18) && + if ((this->animIndex == 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))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2EC == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + if ((this->animIndex == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); } - if ((this->unk_2EC == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + if ((this->animIndex == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -326,10 +337,11 @@ void func_80BFEA94(EnBomjima* this, PlayState* play) { continue; } - this->unk_2F0 = (EnBombal*)actor; + this->bombal = (EnBombal*)actor; Math_Vec3f_Copy(&this->unk_2B0, &actor->world.pos); - if (this->unk_2F4 == 0) { - this->unk_2F4 = this->unk_2F0->actor.cutscene; + + if (this->bombalCutscene == 0) { + this->bombalCutscene = this->bombal->actor.cutscene; } func_80BFEB1C(this); break; @@ -339,7 +351,7 @@ void func_80BFEA94(EnBomjima* this, PlayState* play) { void func_80BFEB1C(EnBomjima* this) { func_80BFE494(this, 1, 1.0f); func_80BFE65C(this); - this->unk_2A0 = 0; + this->action = EN_BOMJIMA_ACTION_0; this->actionFunc = func_80BFEB64; } @@ -381,7 +393,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { func_800B8614(&this->actor, play, 70.0f); } - if ((this->unk_2F0->actor.update == NULL) || (this->unk_2F0->actor.colChkInfo.health == 0)) { + if ((this->bombal->actor.update == NULL) || (this->bombal->actor.colChkInfo.health == 0)) { func_80BFEFF0(this); return; } @@ -394,14 +406,14 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { break; case 1: - this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2F0->actor.world.pos); + this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bombal->actor.world.pos); if (Animation_OnFrame(&this->skelAnime, 19.0f)) { this->unk_2C0 = 5; Actor_PlaySfxAtPos(&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); + s16 sp3E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bombal->actor.world.pos); if (Rand_ZeroOne() < 0.5f) { sp3E += 0x4000; @@ -409,9 +421,9 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { 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; + sp40.x = (Math_SinS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.x; + sp40.y = this->bombal->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f); + sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.z; SoundSource_PlaySfxAtFixedWorldPos(play, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN); EffectSsHitmark_SpawnFixedScale(play, 0, &sp40); @@ -443,10 +455,10 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { } void func_80BFEFF0(EnBomjima* this) { - this->unk_2F0 = NULL; + this->bombal = NULL; func_80BFE494(this, 19, 1.0f); func_80BFE65C(this); - this->unk_2A0 = 1; + this->action = EN_BOMJIMA_ACTION_1; this->actionFunc = func_80BFF03C; } @@ -455,25 +467,25 @@ void func_80BFF03C(EnBomjima* this, PlayState* play) { 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]); + ActorCutscene_SetIntentToPlay(this->cutscenes[0]); + } else if (!ActorCutscene_GetCanPlayNext(this->cutscenes[0])) { + ActorCutscene_SetIntentToPlay(this->cutscenes[0]); } else { player->stateFlags1 &= ~0x20; gSaveContext.save.weekEventReg[83] &= (u8)~4; this->actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); this->unk_2DC = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)); - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[0], &this->actor); + ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor); func_80BFF120(this); } } void func_80BFF120(EnBomjima* this) { func_80BFE65C(this); - this->unk_2C4 = 30; + this->cutsceneTimer = 30; func_80BFE494(this, 6, 1.0f); - this->unk_2DE = 0; - this->unk_2A0 = 2; + this->cutsceneEnded = false; + this->action = EN_BOMJIMA_ACTION_2; this->actionFunc = func_80BFF174; } @@ -481,9 +493,9 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { f32 sp2C = this->skelAnime.curFrame; Player* player = GET_PLAYER(play); - if (this->unk_2C4 == 1) { - ActorCutscene_Stop(this->unk_2D4[0]); - this->unk_2DE = 1; + if (this->cutsceneTimer == 1) { + ActorCutscene_Stop(this->cutscenes[0]); + this->cutsceneEnded = true; } if (Text_GetFaceReaction(play, 0x11) != 0) { @@ -498,9 +510,9 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); - if ((this->unk_2CC <= sp2C) && (this->unk_2BC < 5)) { + if ((this->animLastFrame <= sp2C) && (this->unk_2BC < 5)) { this->unk_2BC++; - if (this->unk_2EC != 19) { + if (this->animIndex != 19) { func_80BFE494(this, 19, 1.0f); } } @@ -541,7 +553,7 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { func_80BFE32C(this, play, 1); } - if (this->unk_2DE != 0) { + if (this->cutsceneEnded != false) { if (this->unk_2BC >= 5) { func_80BFE67C(this, play); } @@ -551,20 +563,20 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { void func_80BFF3F0(EnBomjima* this) { func_80BFE494(this, 15, 1.0f); - this->unk_2A0 = 3; + this->action = EN_BOMJIMA_ACTION_3; this->actionFunc = func_80BFF430; } void func_80BFF430(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->unk_2CC <= curFrame) { + if (this->animLastFrame <= curFrame) { EnBombal* bombal = (EnBombal*)Actor_Spawn(&play->actorCtx, play, 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; + bombal->scale = 0.0f; + bombal->cutscene = this->bombalCutscene; Actor_ChangeFocus(&this->actor, play, &bombal->actor); gSaveContext.save.weekEventReg[83] &= (u8)~4; func_80BFE65C(this); @@ -576,7 +588,7 @@ void func_80BFF430(EnBomjima* this, PlayState* play) { void func_80BFF4F4(EnBomjima* this) { func_80BFE65C(this); - this->unk_2A0 = 4; + this->action = EN_BOMJIMA_ACTION_4; this->actionFunc = func_80BFF52C; } @@ -599,7 +611,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { func_80151938(play, this->actor.textId); play_sound(NA_SE_SY_FOUND); func_80BFE494(this, 15, 1.0f); - this->unk_2A0 = 5; + this->action = EN_BOMJIMA_ACTION_5; this->actionFunc = func_80BFF6CC; } else { Player* player = GET_PLAYER(play); @@ -623,7 +635,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { void func_80BFF6CC(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->unk_2CC <= curFrame) { + if (this->animLastFrame <= curFrame) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80BFE494(this, 1, 1.0f); @@ -635,7 +647,7 @@ void func_80BFF6CC(EnBomjima* this, PlayState* play) { void func_80BFF754(EnBomjima* this, PlayState* play) { Player* player = GET_PLAYER(play); Vec3f spA0; - EnBombal* temp_s3; + EnBomjima* bomjima; s32 i; f32 x; f32 y; @@ -643,12 +655,12 @@ void func_80BFF754(EnBomjima* this, PlayState* play) { if (ActorCutscene_GetCurrentIndex() == 0x7C) { ActorCutscene_Stop(0x7C); - ActorCutscene_SetIntentToPlay(this->unk_2D4[1]); + ActorCutscene_SetIntentToPlay(this->cutscenes[1]); return; } - if (!ActorCutscene_GetCanPlayNext(this->unk_2D4[1])) { - ActorCutscene_SetIntentToPlay(this->unk_2D4[1]); + if (!ActorCutscene_GetCanPlayNext(this->cutscenes[1])) { + ActorCutscene_SetIntentToPlay(this->cutscenes[1]); return; } @@ -663,9 +675,9 @@ void func_80BFF754(EnBomjima* this, PlayState* play) { spA0.y += y * (2.0f + (i * 0.2f)); spA0.z += z * (2.0f + (i * 0.2f)); - temp_s3 = (EnBombal*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOMJIMA, spA0.x, spA0.y, - spA0.z, 0, 0, 0, i + 32); - if (temp_s3 != NULL) { + bomjima = (EnBomjima*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOMJIMA, spA0.x, spA0.y, + spA0.z, 0, 0, 0, i + 32); + if (bomjima != NULL) { s32 index = (i * 2) - 2; Math_Vec3f_Copy(&spA0, &this->actor.world.pos); @@ -673,12 +685,12 @@ void func_80BFF754(EnBomjima* this, PlayState* play) { spA0.x += Math_SinS(D_80C00AF8[(i * 2) - 2] + this->actor.world.rot.y) * D_80C00AF8[index + 1]; spA0.z += Math_CosS(D_80C00AF8[index] + this->actor.world.rot.y) * D_80C00AF8[index + 1]; - Math_Vec3f_Copy(&temp_s3->unk_2A4, &spA0); + Math_Vec3f_Copy(&bomjima->unk_2A4, &spA0); } } D_80C009F0 = 0; - ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[1], &this->actor); + ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[1], &this->actor); this->actionFunc = func_80BFF9B0; } @@ -741,7 +753,7 @@ void func_80BFFB40(EnBomjima* this, PlayState* play) { void func_80BFFBC4(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if ((this->unk_2EC != 1) && (this->unk_2CC <= curFrame)) { + if ((this->animIndex != 1) && (this->animLastFrame <= curFrame)) { func_80BFE494(this, 1, 1.0f); } @@ -762,14 +774,14 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_86; gSaveContext.nextTransitionType = TRANS_TYPE_03; - ActorCutscene_Stop(this->unk_2D4[1]); + ActorCutscene_Stop(this->cutscenes[1]); } } void func_80BFFCFC(EnBomjima* this) { func_80BFE65C(this); func_80BFE494(this, 18, 1.0f); - this->unk_2A0 = 6; + this->action = EN_BOMJIMA_ACTION_6; this->actionFunc = func_80BFFD48; } @@ -825,22 +837,22 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) { } if (this->unk_2E4 != 4) { - if ((this->unk_2EC != 0) && (this->unk_2CC <= curFrame)) { + if ((this->animIndex != 0) && (this->animLastFrame <= curFrame)) { D_80C009F0++; func_80BFE494(this, 0, 1.0f); } - } else if ((this->unk_2EC != 8) && (this->unk_2CC <= curFrame)) { + } else if ((this->animIndex != 8) && (this->animLastFrame <= curFrame)) { func_80BFE494(this, 8, 1.0f); D_80C009F4 = 1; } - if (this->unk_2EC == 8) { + if (this->animIndex == 8) { if ((D_80C009F4 == 1) && Animation_OnFrame(&this->skelAnime, 7.0f)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND); D_80C009F4 = 2; } - if ((this->unk_2CC <= curFrame) && (this->unk_2C0 == 0)) { + if ((this->animLastFrame <= curFrame) && (this->unk_2C0 == 0)) { this->unk_2C0 = 10; } @@ -853,7 +865,7 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) { void func_80C0011C(EnBomjima* this) { func_80BFE65C(this); func_80BFE494(this, 0, 1.0f); - this->unk_2A0 = 7; + this->action = EN_BOMJIMA_ACTION_7; this->actionFunc = func_80C00168; } @@ -894,8 +906,9 @@ void func_80C00284(EnBomjima* this, PlayState* play) { f32 sp28 = this->skelAnime.curFrame; 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->action == EN_BOMJIMA_ACTION_0) || (this->unk_2C8 == 10) || (this->unk_2C8 == 11) || + (this->unk_2CA == 1)) && + (this->animLastFrame <= sp28)) { if (!(this->unk_2BC & 1)) { func_80BFE494(this, 3, 1.0f); } else { @@ -919,14 +932,15 @@ void func_80C00284(EnBomjima* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { 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))) { + if ((this->action == EN_BOMJIMA_ACTION_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)) { + if ((this->bombal == 0) || (this->bombal->actor.update == NULL) || + (this->bombal->actor.colChkInfo.health <= 0)) { func_80BFF3F0(this); } else { func_80BFE65C(this); @@ -941,7 +955,7 @@ void func_80C00284(EnBomjima* this, PlayState* play) { switch (this->unk_2CA) { case 0: this->unk_28E = 0; - if (this->unk_2A0 == 7) { + if (this->action == EN_BOMJIMA_ACTION_7) { func_80C0011C(this); } else { func_80BFEB1C(this); @@ -953,7 +967,7 @@ void func_80C00284(EnBomjima* this, PlayState* play) { func_80BFE65C(this); this->unk_28E = 0; func_80BFE494(this, 1, 1.0f); - this->unk_2A0 = 2; + this->action = EN_BOMJIMA_ACTION_2; this->actionFunc = func_80BFF174; return; } @@ -1008,8 +1022,8 @@ void EnBomjima_Update(Actor* thisx, PlayState* play) { this->unk_2C6--; } - if (this->unk_2C4 != 0) { - this->unk_2C4--; + if (this->cutsceneTimer != 0) { + this->cutsceneTimer--; } SkelAnime_Update(&this->skelAnime); 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 b247e03ea0..046e8813c8 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h @@ -26,7 +26,7 @@ typedef struct EnBomjima { /* 0x296 */ UNK_TYPE1 unk296[4]; /* 0x29A */ s16 unk_29A; /* 0x29C */ UNK_TYPE1 unk29C[4]; - /* 0x2A0 */ s16 unk_2A0; + /* 0x2A0 */ s16 action; /* 0x2A2 */ s16 unk_2A2; /* 0x2A4 */ Vec3f unk_2A4; /* 0x2B0 */ Vec3f unk_2B0; @@ -34,25 +34,25 @@ typedef struct EnBomjima { /* 0x2BE */ s16 unk_2BE; /* 0x2C0 */ s16 unk_2C0; /* 0x2C2 */ s16 unk_2C2; - /* 0x2C4 */ s16 unk_2C4; + /* 0x2C4 */ s16 cutsceneTimer; /* 0x2C6 */ s16 unk_2C6; /* 0x2C8 */ s16 unk_2C8; /* 0x2CA */ s16 unk_2CA; - /* 0x2CC */ f32 unk_2CC; + /* 0x2CC */ f32 animLastFrame; /* 0x2D0 */ f32 unk_2D0; - /* 0x2D4 */ s16 unk_2D4[2]; + /* 0x2D4 */ s16 cutscenes[2]; /* 0x2D8 */ UNK_TYPE1 unk2D8[4]; // maybe a part of the above? /* 0x2DC */ s16 unk_2DC; - /* 0x2DE */ s16 unk_2DE; + /* 0x2DE */ s16 cutsceneEnded; /* 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; + /* 0x2EC */ s32 animIndex; + /* 0x2F0 */ EnBombal* bombal; + /* 0x2F4 */ s16 bombalCutscene; /* 0x2F8 */ ColliderCylinder collider; } EnBomjima; // size = 0x344 diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index b7c698376a..506f147903 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -208,8 +208,8 @@ void EnEncount2_Update(Actor* thisx, PlayState* play) { void EnEncount2_Draw(Actor* thisx, PlayState* play) { EnEncount2* this = THIS; if (this->isPopped != true) { - Gfx_DrawDListOpa(play, object_fusen_DL_000A00); - Gfx_DrawDListOpa(play, object_fusen_DL_000D78); + Gfx_DrawDListOpa(play, gMajoraBalloonDL); + Gfx_DrawDListOpa(play, gMajoraBalloonKnotDL); } EnEncount2_DrawEffects(this, play); } @@ -223,7 +223,7 @@ void EnEncount2_InitEffects(EnEncount2* this, Vec3f* pos, s16 fadeDelay) { sPtr->isEnabled = true; sPtr->pos = *pos; sPtr->alphaFadeDelay = fadeDelay; - sPtr->alpha = 0xFF; + sPtr->alpha = 255; sPtr->accel.x = (Rand_ZeroOne() - 0.5f) * 10.0f; sPtr->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 20fa0265c2..3431e755a9 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -16552,9 +16552,9 @@ 0x80C05DE8:("func_80C05DE8",), 0x80C05E7C:("EnBombal_Update",), 0x80C05F30:("EnBombal_Draw",), - 0x80C05F90:("func_80C05F90",), - 0x80C060B8:("func_80C060B8",), - 0x80C06208:("func_80C06208",), + 0x80C05F90:("EnBombal_InitEffects",), + 0x80C060B8:("EnBombal_UpdateEffects",), + 0x80C06208:("EnBombal_DrawEffects",), 0x80C06510:("ObjMoonStone_Init",), 0x80C0661C:("ObjMoonStone_Destroy",), 0x80C0662C:("func_80C0662C",),