Use composition instead of inheritance for most f_op classes

This commit is contained in:
LagoLunatic
2025-09-25 15:59:25 -04:00
parent 1a828e61ab
commit d89fe27888
26 changed files with 53 additions and 49 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ struct JKRThreadName_ {
};
class JUTConsole;
class JKRThread : JKRDisposer {
class JKRThread : public JKRDisposer {
public:
JKRThread(u32 stack_size, int message_count, int param_3);
JKRThread(OSThread* thread, int message_count);
+3 -3
View File
@@ -210,9 +210,9 @@ namespace daTsubo {
void prm_make_skull() {}
void prm_make_yw1() {}
void prm_off_moveBg() { fopAcM_SetParam(this, base.mParameters | 0xC000); }
void prm_off_stick() { fopAcM_SetParam(this, base.mParameters & ~0x80000000); }
void prm_set_cull_non() { fopAcM_SetParam(this, base.mParameters & ~0x70000000); }
void prm_off_moveBg() { fopAcM_SetParam(this, fopAcM_GetParam(this) | 0xC000); }
void prm_off_stick() { fopAcM_SetParam(this, fopAcM_GetParam(this) & ~0x80000000); }
void prm_set_cull_non() { fopAcM_SetParam(this, fopAcM_GetParam(this) & ~0x70000000); }
void prm_set_itemNo(int) {}
void set_drop_spd_y0(float) {}
bool spec_chk_prm_boko() const { return prm_get_spec() != 0x3F; }
+2 -1
View File
@@ -265,8 +265,9 @@ public:
/* 0xC */ cXyz max;
};
class fopAc_ac_c : public leafdraw_class {
class fopAc_ac_c {
public:
/* 0x000 */ leafdraw_class base;
/* 0x0C0 */ int actor_type;
/* 0x0C4 */ create_tag_class actor_tag;
/* 0x0D8 */ create_tag_class draw_tag;
+1 -1
View File
@@ -678,7 +678,7 @@ void fopDwTg_ToDrawQ(create_tag_class*, int);
void fopDwTg_DrawQTo(create_tag_class*);
inline void fopAcM_onDraw(fopAc_ac_c* actor) {
fopDwTg_ToDrawQ(&actor->draw_tag, fpcLf_GetPriority(actor));
fopDwTg_ToDrawQ(&actor->draw_tag, fpcM_DrawPriority(actor));
}
inline void fopAcM_offDraw(fopAc_ac_c* actor) {
+4 -3
View File
@@ -8,8 +8,8 @@ struct kankyo_method_class {
/* 0x00 */ leafdraw_method_class base;
};
class kankyo_class : public leafdraw_class {
public:
struct kankyo_class {
/* 0x00 */ leafdraw_class base;
/* 0xC0 */ int mBsType;
/* 0xC4 */ create_tag_class draw_tag;
/* 0xD8 */ kankyo_method_class* sub_method;
@@ -23,7 +23,8 @@ struct kankyo_process_profile_definition {
/* 0x24 */ kankyo_method_class* sub_method;
}; // Size: 0x28
class sub_kankyo__class : public kankyo_class {
struct sub_kankyo__class {
/* 0x00 */ kankyo_class base;
};
extern leafdraw_method_class g_fopKy_Method;
+2 -2
View File
@@ -26,8 +26,8 @@ struct msg_method_class {
/* 0x00 */ leafdraw_method_class base;
};
class msg_class : public leafdraw_class {
public:
struct msg_class {
/* 0x00 */ leafdraw_class base;
/* 0xC0 */ int mMsgType;
/* 0xC4 */ create_tag_class draw_tag;
/* 0xD8 */ msg_method_class* sub_method;
+2 -2
View File
@@ -10,8 +10,8 @@ struct overlap_method_class {
/* 0x00 */ leafdraw_method_class base;
};
class overlap_task_class : public leafdraw_class {
public:
struct overlap_task_class {
/* 0x00 */ leafdraw_class base;
/* 0xC0 */ overlap_method_class* sub_method;
/* 0xC4 */ request_base_class mRq;
/* 0xC8 */ fpc_ProcID mScenePId;
+2 -2
View File
@@ -8,8 +8,8 @@
struct layer_class;
class overlap_task_class;
class overlap_request_class : public request_base_class {
public:
struct overlap_request_class {
/* 0x00 */ request_base_class base;
/* 0x01 */ u8 field_0x1;
/* 0x02 */ s16 mDelay;
/* 0x04 */ u16 field_0x4;
+2 -1
View File
@@ -5,7 +5,8 @@
#include "f_pc/f_pc_create_tag.h"
#include "f_pc/f_pc_node.h"
class scene_tag_class : public create_tag_class {
struct scene_tag_class {
/* 0x00 */ create_tag_class base;
};
void fopScnTg_QueueTo(scene_tag_class* pSceneTag);
+3 -2
View File
@@ -40,7 +40,8 @@ struct view_port_class {
/* 0x18 */ scissor_class mScissor;
};
struct view_class : public leafdraw_class {
struct view_class {
/* 0x000 */ leafdraw_class base;
/* 0x0C0 */ leafdraw_method_class* sub_method;
/* 0x0C4 */ u8 field_0xc4;
/* 0x0C8 */ f32 mNear;
@@ -58,4 +59,4 @@ struct view_class : public leafdraw_class {
extern leafdraw_method_class g_fopVw_Method;
#endif
#endif
+1 -1
View File
@@ -38,7 +38,7 @@ inline fpc_ProcID fpcM_Create(s16 procName, FastCreateReqFunc createFunc, void*
}
inline s16 fpcM_DrawPriority(void* pProc) {
return fpcLf_GetPriority((leafdraw_class*)pProc);
return (s16)fpcLf_GetPriority((leafdraw_class*)pProc);
}
inline s32 fpcM_ChangeLayerID(void* pProc, int layerID) {
+2 -2
View File
@@ -1363,9 +1363,9 @@ void bb_atack_move(bb_class* i_this) {
}
#if VERSION == VERSION_DEMO
if (&player->base == fpcM_Search(pl_name_check, i_this) || l_bbHIO.unk_10 != 0)
if (&player->base.base == fpcM_Search(pl_name_check, i_this) || l_bbHIO.unk_10 != 0)
#else
if (&player->base == fpcM_Search(pl_name_check, i_this))
if (&player->base.base == fpcM_Search(pl_name_check, i_this))
#endif
{
bb_kamome_attack(i_this);
+5 -5
View File
@@ -355,7 +355,7 @@ void hand_calc(bmdhand_class* i_this) {
switch (i_this->m2BC) {
case 0:
mDoMtx_YrotS(*calc_mtx, actor->current.angle.y);
if ((actor->base.mParameters & 1U) == 0) {
if ((fopAcM_GetParam(actor) & 1U) == 0) {
local_b8.z = REG0_F(9) + 250.0f;
} else {
local_b8.z = REG0_F(10) + 350.0f;
@@ -375,7 +375,7 @@ void hand_calc(bmdhand_class* i_this) {
break;
case 1:
mDoMtx_YrotS(*calc_mtx, actor->current.angle.y);
if ((actor->base.mParameters & 1U) == 0) {
if ((fopAcM_GetParam(actor) & 1U) == 0) {
local_b8.z = REG0_F(9) + 250.0f;
} else {
local_b8.z = REG0_F(10) + 350.0f;
@@ -442,7 +442,7 @@ void start_hand_calc(bmdhand_class* i_this) {
f32 fVar1 = (i_this->m2E4.y - i_this->m2D8.y) * ((REG13_F(4) + 0.1f) * (REG13_F(5) + 2.0f));
local_a8.x = fVar1 * cM_ssin(i_this->m2B8 * (REG13_S(5) + 0x5dc));
local_a8.y = fVar1 * cM_scos(i_this->m2B8 * (REG13_S(7) + 500));
if ((actor->base.mParameters & 1U) == 0) {
if ((fopAcM_GetParam(actor) & 1U) == 0) {
local_a8.z = REG0_F(9) + 250.0f;
} else {
local_a8.z = REG0_F(10) + 350.0f;
@@ -469,10 +469,10 @@ void hand_move(bmdhand_class* i_this) {
hand_s* pcVar9 = i_this->m324;
if (boss != NULL) {
actor->current.angle.y = (fopAcM_GetParam(actor) & 0x1f) * -0xccc + REG8_S(4) + -13000 + boss->actor.shape_angle.y;
MTXCopy(boss->mpMorf->getModel()->getAnmMtx(boss_joint_d[(actor->base.mParameters & 0x1fU)]), *calc_mtx);
MTXCopy(boss->mpMorf->getModel()->getAnmMtx(boss_joint_d[(fopAcM_GetParam(actor) & 0x1fU)]), *calc_mtx);
local_40.x = REG14_F(6);
local_40.y = REG14_F(7);
local_40.z = boss_joint_xad[(actor->base.mParameters & 3U)];
local_40.z = boss_joint_xad[(fopAcM_GetParam(actor) & 3U)];
MtxPosition(&local_40, &actor->current.pos);
if ((i_this->m2BA != 2) && (boss->m332 == 3)) {
i_this->m2BA = 2;
+1 -1
View File
@@ -2577,7 +2577,7 @@ static cPhs_State daBwd_Create(fopAc_ac_c* a_this) {
if (res != cPhs_COMPLEATE_e) {
return res;
}
i_this->m02BC = (u8)actor->base.mParameters;
i_this->m02BC = fopAcM_GetParam(actor) & 0xFF;
if (!fopAcM_entrySolidHeap(actor, useHeapInit, 0x96000)) {
return cPhs_ERROR_e;
}
+1 -1
View File
@@ -86,7 +86,7 @@ BOOL daObjLadder::Act_c::Create() {
mDoMtx_stack_c::pop();
mGndChk.SetPos(&pos);
mGndChk.SetActorPid(base.mBsPcId);
mGndChk.SetActorPid(base.base.mBsPcId);
mGndY = dComIfG_Bgsp()->GroundCross(&mGndChk);
unk346 = 0;
+1 -1
View File
@@ -476,7 +476,7 @@ cPhs_State daObjLeaves_c::_create() {
fopAcM_SetupActor(this, daObjLeaves_c);
if (base.mInitState == 0) {
if (fopAcM_IsFirstCreating(this)) {
m43C = chk_appear();
}
+4 -4
View File
@@ -127,7 +127,7 @@ namespace daObjMovebox {
cXyz pos;
mDoMtx_stack_c::multVec(&offset, &pos);
M_gnd_work[i].SetPos(&pos);
M_gnd_work[i].SetActorPid(movebox->base.mBsPcId);
M_gnd_work[i].SetActorPid(movebox->base.base.mBsPcId);
mGroundY[i] = dComIfG_Bgsp()->GroundCross(&M_gnd_work[i]);
if (mGroundY[i] > maxGroundY) {
fopAc_ac_c* groundActor = dComIfG_Bgsp()->GetActorPointer(M_gnd_work[i]);
@@ -184,7 +184,7 @@ namespace daObjMovebox {
startPos += movebox->current.pos;
endPos = startPos + temp_20;
M_wall_work[i].Set(&startPos, &endPos, const_cast<Act_c*>(movebox));
M_wall_work[i].SetActorPid(movebox->base.mBsPcId);
M_wall_work[i].SetActorPid(movebox->base.base.mBsPcId);
if (dComIfG_Bgsp()->LineCross(&M_wall_work[i])) {
mWallPos[i] = M_wall_work[i].GetCross();
f32 dist_sq = startPos.abs2(mWallPos[i]);
@@ -273,7 +273,7 @@ namespace daObjMovebox {
startPos += movebox->current.pos;
endPos = startPos + direction;
touch_work.SetActorPid(movebox->base.mBsPcId);
touch_work.SetActorPid(movebox->base.base.mBsPcId);
touch_work.Set(&startPos, &endPos, const_cast<Act_c*>(movebox));
return dComIfG_Bgsp()->LineCross(&touch_work);
}
@@ -1732,7 +1732,7 @@ namespace daObjMovebox {
cXyz centerPos(current.pos.x, current.pos.y + 100.0f, current.pos.z);
dBgS_ObjGndChk gndChk;
gndChk.SetPos(&centerPos);
gndChk.SetActorPid(base.mBsPcId);
gndChk.SetActorPid(base.base.mBsPcId);
dComIfG_Bgsp()->GroundCross(&gndChk);
s32 bgIndex = gndChk.GetBgIndex();
s32 mtrlSndId = 0;
+1 -1
View File
@@ -489,7 +489,7 @@ void Act_c::set_senv(int arg1, int arg2) const {
/* 00001B7C-00001BB4 .text cam_lockoff__Q28daStone25Act_cCFv */
void Act_c::cam_lockoff() const {
camera_class* camera = dComIfGp_getCamera(0);
camera->mCamera.ForceLockOff(base.mBsPcId);
camera->mCamera.ForceLockOff(base.base.mBsPcId);
}
/* 00001BB4-00001BE4 .text mode_wait_init__Q28daStone25Act_cFv */
+2 -2
View File
@@ -1938,7 +1938,7 @@ void Act_c::mode_carry_init() {
se_pickup_carry_init();
}
cLib_offBit<u32>(base.mParameters, 0x80000000);
prm_off_stick();
m685 = 0;
m686 = 0;
m678 = 4;
@@ -3514,7 +3514,7 @@ void Act_c::set_senv(int arg1, int arg2) const {
/* 00007840-00007878 .text cam_lockoff__Q27daTsubo5Act_cCFv */
void Act_c::cam_lockoff() const {
dComIfGp_getCamera(0)->mCamera.ForceLockOff(base.mBsPcId);
dComIfGp_getCamera(0)->mCamera.ForceLockOff(base.base.mBsPcId);
}
/* 00007878-00007B08 .text _execute__Q27daTsubo5Act_cFv */
+1 -1
View File
@@ -4772,7 +4772,7 @@ bool camera_draw(camera_process_class* i_this) {
body->Draw();
if (fpcLf_GetPriority(a_this) != 1) {
if (fpcM_DrawPriority(a_this) != 1) {
get_camera_id(a_this);
for (int i = 0; i < 1; i++) {
if (!fopOvlpM_IsDoingReq()) {
+1 -1
View File
@@ -299,7 +299,7 @@ cPhs_State fopAc_Create(void* pProc) {
cPhs_State status = fpcMtd_Create((process_method_class*)actor->sub_method, actor);
if (status == cPhs_COMPLEATE_e) {
s32 priority = fpcLf_GetPriority(actor);
s32 priority = fpcM_DrawPriority(actor);
fopDwTg_ToDrawQ(&actor->draw_tag, priority);
}
+1 -1
View File
@@ -66,7 +66,7 @@ cPhs_State fopCam_Create(void* pProc) {
cPhs_State ret = fpcMtd_Create(&camera->mpMtd->base, camera);
if (ret == cPhs_COMPLEATE_e) {
s32 priority = fpcLf_GetPriority(camera);
s32 priority = fpcM_DrawPriority(camera);
fopDwTg_ToDrawQ(&camera->draw_tag, priority);
}
+1 -1
View File
@@ -82,7 +82,7 @@ static cPhs_State fopKy_Create(void* i_ky) {
cPhs_State ret = fpcMtd_Create((process_method_class*)i_this->sub_method, i_this);
if (ret == cPhs_COMPLEATE_e) {
s32 priority = fpcLf_GetPriority(i_this);
s32 priority = fpcM_DrawPriority(i_this);
fopDwTg_ToDrawQ(&i_this->draw_tag, priority);
}
+1 -1
View File
@@ -72,7 +72,7 @@ cPhs_State fopMsg_Create(void* i_this) {
cPhs_State status = fpcMtd_Create((process_method_class*)_this->sub_method, _this);
if (status == cPhs_COMPLEATE_e) {
s32 priority = fpcLf_GetPriority(_this);
s32 priority = fpcM_DrawPriority(_this);
fopDwTg_ToDrawQ(&_this->draw_tag, priority);
}
+2 -2
View File
@@ -51,7 +51,7 @@ BOOL fopOvlpM_IsPeek() {
BOOL fopOvlpM_IsDone() {
if (l_fopOvlpM_overlap[0] != NULL)
return cReq_Is_Done(l_fopOvlpM_overlap[0]);
return cReq_Is_Done(&l_fopOvlpM_overlap[0]->base);
else
return FALSE;
}
@@ -76,7 +76,7 @@ static overlap_request_class l_fopOvlpM_Request;
request_base_class* fopOvlpM_Request(s16 procName, u16 peekTime) {
if (l_fopOvlpM_overlap[0] == NULL) {
l_fopOvlpM_overlap[0] = fopOvlpReq_Request(&l_fopOvlpM_Request, procName, peekTime);
return l_fopOvlpM_overlap[0];
return &l_fopOvlpM_overlap[0]->base;
}
return NULL;
+6 -6
View File
@@ -25,7 +25,7 @@ static cPhs_State fopOvlpReq_phase_Done(overlap_request_class* i_this) {
}
static cPhs_State fopOvlpReq_phase_IsDone(overlap_request_class* i_this) {
cReq_Done(i_this);
cReq_Done(&i_this->base);
if (i_this->mDelay-- <= 0)
return cPhs_NEXT_e;
else
@@ -45,7 +45,7 @@ static cPhs_State fopOvlpReq_phase_WaitOfFadeout(overlap_request_class* i_this)
if (i_this->mPeektime)
i_this->mPeektime--;
if (i_this->flag2 == 2 && !i_this->mPeektime) {
if (i_this->base.flag2 == 2 && !i_this->mPeektime) {
cReq_Command(&i_this->mpTask->mRq, 2);
return cPhs_NEXT_e;
}
@@ -56,7 +56,7 @@ static cPhs_State fopOvlpReq_phase_WaitOfFadeout(overlap_request_class* i_this)
static cPhs_State fopOvlpReq_phase_IsComplete(overlap_request_class* i_this) {
if (cReq_Is_Done(&i_this->mpTask->mRq)) {
cReq_Done(i_this);
cReq_Done(&i_this->base);
return cPhs_NEXT_e;
}
@@ -99,7 +99,7 @@ overlap_request_class* fopOvlpReq_Request(overlap_request_class* i_this, s16 pro
return i_this;
}
cReq_Command(i_this, 1);
cReq_Command(&i_this->base, 1);
i_this->mProcName = procName;
cPhs_Set(&i_this->mPhs, phaseMethod);
fopOvlpReq_SetPeektime(i_this, peekTime);
@@ -148,9 +148,9 @@ void fopOvlpReq_SetPeektime(overlap_request_class* i_this, u16 peekTime) {
}
BOOL fopOvlpReq_OverlapClr(overlap_request_class* i_this) {
if (i_this->flag0 == 1 || !fopOvlpReq_Is_PeektimeLimit(i_this))
if (i_this->base.flag0 == 1 || !fopOvlpReq_Is_PeektimeLimit(i_this))
return FALSE;
cReq_Create(i_this, 2);
cReq_Create(&i_this->base, 2);
return TRUE;
}