summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2025-09-17 16:56:25 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2025-09-17 16:56:25 -0400
commita13640e949676caaed82f2d36d24f927734e14ba (patch)
treeae0f5faef3a258d6acf4564c88f51a10ae69ac2c /src
parent4558c9e6af780dba0d8f3186502b58311a9ac1b9 (diff)
jbo cleanup, almost matching for demo
Diffstat (limited to 'src')
-rw-r--r--src/d/actor/d_a_jbo.cpp132
-rw-r--r--src/d/actor/d_a_obj_ojtree.cpp3
2 files changed, 71 insertions, 64 deletions
diff --git a/src/d/actor/d_a_jbo.cpp b/src/d/actor/d_a_jbo.cpp
index 833eb675..c3279e47 100644
--- a/src/d/actor/d_a_jbo.cpp
+++ b/src/d/actor/d_a_jbo.cpp
@@ -14,8 +14,16 @@
#include "f_op/f_op_actor_mng.h"
#include "d/d_priority.h"
+#define JUMP_ANIMATION_TIME 70
+
+enum daJbo_Mode {
+ daJbo_Mode_IDLE_e = 0,
+ daJbo_Mode_WAIT_JUMP_e = 1,
+ daJbo_Mode_SPAWN_e = 2,
+};
+
/* 00000078-00000108 .text nodeCallBack__FP7J3DNodei */
-static BOOL nodeCallBack(J3DNode *i_node, int i_calcTiming) {
+static BOOL nodeCallBack(J3DNode* i_node, int i_calcTiming) {
if (i_calcTiming == J3DNodeCBCalcTiming_In) {
J3DJoint* joint = reinterpret_cast<J3DJoint*>(i_node);
s32 jntNo = joint->getJntNo();
@@ -33,18 +41,17 @@ static BOOL nodeCallBack(J3DNode *i_node, int i_calcTiming) {
}
/* 00000108-00000240 .text jbo_draw_SUB__FP9jbo_class */
-void jbo_draw_SUB(jbo_class *i_this) {
+void jbo_draw_SUB(jbo_class* i_this) {
+ fopAc_ac_c* actor = &i_this->actor;
J3DModel *model = i_this->mpMorf->getModel();
- model->setBaseScale(i_this->scale);
- mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z);
- mDoMtx_stack_c::YrotM(i_this->shape_angle.y);
- mDoMtx_stack_c::XrotM(i_this->shape_angle.x);
- mDoMtx_stack_c::ZrotM(i_this->shape_angle.z);
+ model->setBaseScale(actor->scale);
+ mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z);
+ mDoMtx_stack_c::YrotM(actor->shape_angle.y);
+ mDoMtx_stack_c::XrotM(actor->shape_angle.x);
+ mDoMtx_stack_c::ZrotM(actor->shape_angle.z);
if (i_this->mAnimationSpeed) {
cXyz scale;
- scale.x = REG8_F(1) + 1.1F;
- scale.y = REG8_F(2) + 1.0F;
- scale.z = REG8_F(3) + 0.9F;
+ scale.set(REG8_F(1) + 1.1F, REG8_F(2) + 1.0F, REG8_F(3) + 0.9F);
i_this->mAnimRotation += i_this->mAnimationSpeed;
mDoMtx_stack_c::YrotM(i_this->mAnimRotation);
mDoMtx_stack_c::scaleM(scale);
@@ -54,66 +61,59 @@ void jbo_draw_SUB(jbo_class *i_this) {
}
/* 00000240-000002C4 .text daJBO_Draw__FP9jbo_class */
-static BOOL daJBO_Draw(jbo_class *i_this) {
+static BOOL daJBO_Draw(jbo_class* i_this) {
+ fopAc_ac_c* actor = &i_this->actor;
J3DModel *model = i_this->mpMorf->getModel();
- if (i_this->mParam == 3)
+ if (i_this->mType == daJbo_Type_APPEAR_AFTER_DEKU_TREE_e)
return TRUE;
- g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->tevStr);
- g_env_light.setLightTevColorType(model, &i_this->tevStr);
+ g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &actor->current.pos, &actor->tevStr);
+ g_env_light.setLightTevColorType(model, &actor->tevStr);
i_this->mpMorf->updateDL();
return TRUE;
}
-// time from link entering blub to being vomited out
-#define JUMP_ANIMATION_TIME 70
-
-enum daJbo_State {
- daJbo_State_IDLE = 0,
- daJbo_State_WAIT_JUMP = 1,
- daJbo_State_SPAWN = 2,
-};
-
/* 000002C4-00000584 .text jbo_move__FP9jbo_class */
-void jbo_move(jbo_class *i_this) {
- u8 state = i_this->mState;
- switch (state) {
- case daJbo_State_IDLE: {
- if (dComIfGp_checkPlayerStatus0(0, daPyStts0_UNK80_e) && i_this->mSph.ChkCoHit()) {
+void jbo_move(jbo_class* i_this) {
+ fopAc_ac_c* actor = &i_this->actor;
+ switch (i_this->mMode) {
+ case daJbo_Mode_IDLE_e: {
+ if (dComIfGp_checkPlayerStatus0(0, daPyStts0_UNK80_e) && i_this->mCoSph.ChkCoHit()) {
J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectRes("JBO", JBO_BCK_IN1);
i_this->mpMorf->setAnm(anm, J3DFrameCtrl::EMode_NONE, 0.0, 1.0, 0.0, -1.0, NULL);
- fopAcM_seStart(i_this, JA_SE_OBJ_JFLOWER_IN, 0);
+ fopAcM_seStart(actor, JA_SE_OBJ_JFLOWER_IN, 0);
dComIfGp_setItemMagicCount(4);
i_this->mFramesUntilJump = JUMP_ANIMATION_TIME;
- i_this->mState += 1;
+ i_this->mMode += 1;
}
break;
}
- case daJbo_State_WAIT_JUMP: {
+ case daJbo_Mode_WAIT_JUMP_e: {
i_this->mAnimationSpeed = JUMP_ANIMATION_TIME - i_this->mFramesUntilJump;
i_this->mAnimationSpeed *= 200;
if (i_this->mFramesUntilJump == 1) {
- ((daPy_py_c *)dComIfGp_getPlayer(0))->onForceVomitJump();
+ daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
+ player->onForceVomitJump();
}
if (dComIfGp_checkPlayerStatus0(0, daPyStts0_UNK80000000_e)) {
J3DAnmTransform* anm = (J3DAnmTransform*)dComIfG_getObjectRes("JBO", JBO_BCK_OUT1);
i_this->mpMorf->setAnm(anm, J3DFrameCtrl::EMode_NONE, 0.0, 1.0, 0.0, -1.0, NULL);
- fopAcM_seStart(i_this, JA_SE_OBJ_JFLOWER_OUT, 0);
+ fopAcM_seStart(actor, JA_SE_OBJ_JFLOWER_OUT, 0);
i_this->mAnimationSpeed = 0;
i_this->mAnimRotation = 0;
- JPABaseEmitter *emitter = dComIfGp_particle_setToon(0xa110, &i_this->mParticlePos);
+ JPABaseEmitter* emitter = dComIfGp_particle_setToon(0xa110, &i_this->mParticlePos);
if (emitter != NULL) {
emitter->setGlobalAlpha(100);
}
- if (i_this->mParam == 2) {
+ if (i_this->mType == daJbo_Type_UNK_2_e) {
i_this->m2BA = 1;
}
- i_this->mState = daJbo_State_IDLE;
+ i_this->mMode = daJbo_Mode_IDLE_e;
}
break;
}
- case daJbo_State_SPAWN: {
+ case daJbo_Mode_SPAWN_e: {
if (i_this->mpMorf->isStop()) {
- i_this->mState = daJbo_State_IDLE;
+ i_this->mMode = daJbo_Mode_IDLE_e;
}
break;
}
@@ -122,10 +122,11 @@ void jbo_move(jbo_class *i_this) {
/* 00000584-00000698 .text daJBO_Execute__FP9jbo_class */
static BOOL daJBO_Execute(jbo_class* i_this) {
- if (i_this->mParam == 3) {
+ fopAc_ac_c* actor = &i_this->actor;
+ if (i_this->mType == daJbo_Type_APPEAR_AFTER_DEKU_TREE_e) {
if (dComIfGs_isEventBit(0x1801)) {
- i_this->mParam = 0;
- i_this->mSph.OnCoSPrmBit(cCcD_CoSPrm_Set_e);
+ i_this->mType = daJbo_Type_NORMAL_e;
+ i_this->mCoSph.OnCoSetBit();
}
return TRUE;
}
@@ -138,11 +139,11 @@ static BOOL daJBO_Execute(jbo_class* i_this) {
break;
}
i_this->mpMorf->play(NULL, 0, 0);
- cXyz pos(i_this->current.pos);
+ cXyz pos(actor->current.pos);
pos.y += 30.0;
- i_this->mSph.SetC(pos);
- i_this->mSph.SetR(55.0);
- dComIfG_Ccsp()->Set(&i_this->mSph);
+ i_this->mCoSph.SetC(pos);
+ i_this->mCoSph.SetR(55.0);
+ dComIfG_Ccsp()->Set(&i_this->mCoSph);
jbo_draw_SUB(i_this);
return TRUE;
}
@@ -154,7 +155,7 @@ static BOOL daJBO_IsDelete(jbo_class*) {
/* 000006A0-000006D0 .text daJBO_Delete__FP9jbo_class */
static BOOL daJBO_Delete(jbo_class* i_this) {
- dComIfG_resDelete(&i_this->mPhs, "JBO");
+ dComIfG_resDeleteDemo(&i_this->mPhs, "JBO");
return TRUE;
}
@@ -188,24 +189,29 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) {
/* 0000081C-00000A90 .text daJBO_Create__FP10fopAc_ac_c */
static cPhs_State daJBO_Create(fopAc_ac_c* i_this) {
+ #if VERSION > VERSION_DEMO
fopAcM_SetupActor(i_this, jbo_class);
+ #endif
jbo_class* a_this = (jbo_class*)i_this;
cPhs_State state = dComIfG_resLoad(&a_this->mPhs, "JBO");
if (state == cPhs_COMPLEATE_e) {
+ #if VERSION == VERSION_DEMO
+ fopAcM_SetupActor(i_this, jbo_class);
+ #endif
if (!fopAcM_entrySolidHeap(i_this, &useHeapInit, 0x1c20)) {
return cPhs_ERROR_e;
} else {
- a_this->mParam = fopAcM_GetParam(a_this);
- if (a_this->mParam == 0xFF) {
- a_this->mParam = 0;
+ a_this->mType = fopAcM_GetParam(a_this);
+ if (a_this->mType == 0xFF) {
+ a_this->mType = daJbo_Type_NORMAL_e;
}
if (REG8_S(9) != 0) {
- a_this->mParam = REG8_S(9);
+ a_this->mType = REG8_S(9);
}
- fopAcM_SetMtx(a_this, a_this->mpMorf->getModel()->getBaseTRMtx());
- a_this->attention_info.flags = 0;
- a_this->mStts.Init(0xff, 0xff, a_this);
+ fopAcM_SetMtx(i_this, a_this->mpMorf->getModel()->getBaseTRMtx());
+ i_this->attention_info.flags = 0;
+ a_this->mStts.Init(0xff, 0xff, i_this);
static dCcD_SrcSph co_sph_src = {
// dCcD_SrcGObjInf
{
@@ -215,7 +221,7 @@ static cPhs_State daJBO_Create(fopAc_ac_c* i_this) {
/* SrcObjAt SPrm */ 0,
/* SrcObjTg Type */ 0,
/* SrcObjTg SPrm */ 0,
- /* SrcObjCo SPrm */ cCcD_CoSPrm_VsEnemy_e|cCcD_CoSPrm_IsOther_e|cCcD_CoSPrm_Set_e,
+ /* SrcObjCo SPrm */ cCcD_CoSPrm_Set_e | cCcD_CoSPrm_IsOther_e | cCcD_CoSPrm_VsEnemy_e,
/* SrcGObjAt Se */ 0,
/* SrcGObjAt HitMark */ 0,
/* SrcGObjAt Spl */ 0,
@@ -234,19 +240,19 @@ static cPhs_State daJBO_Create(fopAc_ac_c* i_this) {
/* Radius */ 15.0f,
}},
};
- a_this->mSph.Set(co_sph_src);
- a_this->mSph.SetStts(&a_this->mStts);
- if (a_this->mParam == 3) {
- fopAcM_OffStatus(a_this, fopAcStts_SHOWMAP_e);
- a_this->mSph.ClrCoSet();
+ a_this->mCoSph.Set(co_sph_src);
+ a_this->mCoSph.SetStts(&a_this->mStts);
+ if (a_this->mType == daJbo_Type_APPEAR_AFTER_DEKU_TREE_e) {
+ fopAcM_OffStatus(i_this, fopAcStts_SHOWMAP_e);
+ a_this->mCoSph.ClrCoSet();
}
- if (a_this->mParam == 1) {
+ if (a_this->mType == daJbo_Type_POPS_UP_e) {
J3DAnmTransform* pAnimRes = (J3DAnmTransform*) dComIfG_getObjectRes("JBO", JBO_BCK_UMARERU1);
a_this->mpMorf->setAnm(pAnimRes, J3DFrameCtrl::EMode_NONE, 0.0, 1.0, 0.0, -1.0, NULL);
- fopAcM_seStart(a_this, JA_SE_CM_BV_BASE_POPUP, 0);
- a_this->mState = daJbo_State_SPAWN;
+ fopAcM_seStart(i_this, JA_SE_CM_BV_BASE_POPUP, 0);
+ a_this->mMode = daJbo_Mode_SPAWN_e;
}
- a_this->gbaName = 0x21;
+ i_this->gbaName = 0x21;
jbo_draw_SUB(a_this);
}
}
diff --git a/src/d/actor/d_a_obj_ojtree.cpp b/src/d/actor/d_a_obj_ojtree.cpp
index 8c3375cd..77bcee5e 100644
--- a/src/d/actor/d_a_obj_ojtree.cpp
+++ b/src/d/actor/d_a_obj_ojtree.cpp
@@ -5,6 +5,7 @@
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/res/res_ojtree.h"
+#include "d/actor/d_a_jbo.h"
#include "d/actor/d_a_obj_ojtree.h"
#include "d/d_com_inf_game.h"
#include "m_Do/m_Do_mtx.h"
@@ -31,7 +32,7 @@ BOOL daObjOjtree::Act_c::Create() {
fopAcM_setCullSizeBox(this, -500.0f, -1.0f, -300.0f, 251.0f, 5001.0f, 251.0f);
pos.set(current.pos);
pos.y += 5000.0f;
- fopAcM_create(PROC_JBO, 0, &pos, home.roomNo, &shape_angle, NULL, 0xff, NULL);
+ fopAcM_create(PROC_JBO, daJbo_Type_NORMAL_e, &pos, home.roomNo, &shape_angle, NULL, 0xff, NULL);
mLockTimer = 2;
return TRUE;
}