Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d_a_obj_ojtree matching #591

Merged
merged 5 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,7 @@ def DolphinLib(lib_name, objects):
ActorRel(NonMatching, "d_a_obj_msdan_sub2"),
ActorRel(NonMatching, "d_a_obj_mtest", extra_cflags=['-pragma "nosyminline on"']),
ActorRel(NonMatching, "d_a_obj_nest"),
ActorRel(NonMatching, "d_a_obj_ojtree"),
ActorRel(Matching, "d_a_obj_ojtree"),
ActorRel(NonMatching, "d_a_obj_ospbox"),
ActorRel(Matching, "d_a_obj_paper", extra_cflags=['-pragma "nosyminline on"']),
ActorRel(Matching, "d_a_obj_pbka"),
Expand Down
24 changes: 17 additions & 7 deletions include/d/actor/d_a_obj_ojtree.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@
#define D_A_OBJ_OJTREE_H

#include "f_op/f_op_actor.h"
#include "d/d_bg_s_movebg_actor.h"


namespace daObjOjtree {
class Act_c : public fopAc_ac_c {
class Act_c : public dBgS_MoveBgActor {
public:
void CreateHeap();
s32 Create();
void Mthd_Create();

static Mtx M_tmp_mtx;
static const char M_arcname[];

int CreateHeap();
int Create();
s32 Mthd_Create();
BOOL Delete();
void Mthd_Delete();
s32 Mthd_Delete();
void set_mtx();
void init_mtx();
void Execute(float(**)[3][4]);
int Execute(Mtx**);
BOOL Draw();

public:
/* Place member variables here */
/* 0x2C8 */ request_of_phase_process_class mPhs;
/* 0x2D0 */ J3DModel* mpModel;
/* 0x2D4 */ u8 field_0x2d4;
/* 0x2D5 */ u8 field_0x2d5[0x2d7 - 0x2d5];
};
};

Expand Down
135 changes: 120 additions & 15 deletions src/d/actor/d_a_obj_ojtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,155 @@
// Translation Unit: d_a_obj_ojtree.cpp
//

#include "SSystem/SComponent/c_bg_w.h"
#include "d/actor/d_a_obj_ojtree.h"
#include "dolphin/types.h"
#include "d/d_com_inf_game.h"
#include "m_Do/m_Do_mtx.h"
#include "d/d_procname.h"



Mtx daObjOjtree::Act_c::M_tmp_mtx;
const char daObjOjtree::Act_c::M_arcname[] = "Ojtree";

enum OJTREE_RES_FILE_ID { // IDs and indexes are synced
/* BDL */
OJTREE_BDL_OJTREE=0x4,

/* DZB */
OJTREE_DZB_OJTREE=0x7,
};

/* 00000078-0000012C .text CreateHeap__Q211daObjOjtree5Act_cFv */
void daObjOjtree::Act_c::CreateHeap() {
/* Nonmatching */
int daObjOjtree::Act_c::CreateHeap() {
J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, OJTREE_BDL_OJTREE);
JUT_ASSERT(67, model_data != 0);
mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000022);
return !!mpModel;
}

/* 0000012C-000001EC .text Create__Q211daObjOjtree5Act_cFv */
s32 daObjOjtree::Act_c::Create() {
/* Nonmatching */
int daObjOjtree::Act_c::Create() {
cXyz pos;

fopAcM_SetMtx(this, mpModel->getBaseTRMtx());
init_mtx();
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);
field_0x2d4 = 2;
return TRUE;
}

/* 000001EC-000002E4 .text Mthd_Create__Q211daObjOjtree5Act_cFv */
void daObjOjtree::Act_c::Mthd_Create() {
/* Nonmatching */
s32 daObjOjtree::Act_c::Mthd_Create() {
fopAcM_SetupActor(this, daObjOjtree::Act_c);

s32 phase_state = dComIfG_resLoad(&mPhs, M_arcname);
if (phase_state == cPhs_COMPLEATE_e) {
phase_state = MoveBGCreate(M_arcname, OJTREE_DZB_OJTREE, NULL, 0x26a0);
JUT_ASSERT(123, (phase_state == cPhs_COMPLEATE_e) || (phase_state == cPhs_ERROR_e));
}

return phase_state;
}

/* 000002E4-000002EC .text Delete__Q211daObjOjtree5Act_cFv */
BOOL daObjOjtree::Act_c::Delete() {
/* Nonmatching */
return TRUE;
}

/* 000002EC-00000338 .text Mthd_Delete__Q211daObjOjtree5Act_cFv */
void daObjOjtree::Act_c::Mthd_Delete() {
/* Nonmatching */
s32 daObjOjtree::Act_c::Mthd_Delete() {
s32 result = MoveBGDelete();
dComIfG_resDelete(&mPhs, M_arcname);
return result;
}

/* 00000338-000003B8 .text set_mtx__Q211daObjOjtree5Act_cFv */
void daObjOjtree::Act_c::set_mtx() {
/* Nonmatching */
mDoMtx_stack_c::transS(current.pos);
mDoMtx_stack_c::ZXYrotM(shape_angle);
cMtx_copy(mDoMtx_stack_c::get(), mpModel->mBaseTransformMtx);
cMtx_copy(mDoMtx_stack_c::get(), M_tmp_mtx);
}

/* 000003B8-000003F4 .text init_mtx__Q211daObjOjtree5Act_cFv */
void daObjOjtree::Act_c::init_mtx() {
/* Nonmatching */
mpModel->setBaseScale(mScale);
set_mtx();
}

/* 000003F4-0000045C .text Execute__Q211daObjOjtree5Act_cFPPA3_A4_f */
void daObjOjtree::Act_c::Execute(float(**)[3][4]) {
/* Nonmatching */
int daObjOjtree::Act_c::Execute(Mtx** pMtx) {
if(field_0x2d4 != 0)
{
if (--field_0x2d4 == 0)
{
mpBgW->SetLock();
}
}
set_mtx();
*pMtx = &M_tmp_mtx;
return TRUE;
}

/* 0000045C-000004FC .text Draw__Q211daObjOjtree5Act_cFv */
BOOL daObjOjtree::Act_c::Draw() {
/* Nonmatching */
g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &current.pos, &mTevStr);
g_env_light.setLightTevColorType(mpModel, &mTevStr);
dComIfGd_setListBG();
mDoExt_modelUpdateDL(mpModel);
dComIfGd_setList();
return TRUE;
}

namespace daObjOjtree {
namespace {
s32 Mthd_Create(void* i_this) {
return static_cast<Act_c*>(i_this)->Mthd_Create();
}

s32 Mthd_Delete(void* i_this) {
return static_cast<Act_c*>(i_this)->Mthd_Delete();
}

BOOL Mthd_Execute(void* i_this) {
return static_cast<Act_c*>(i_this)->MoveBGExecute();
}

BOOL Mthd_Draw(void* i_this) {
return static_cast<Act_c*>(i_this)->MoveBGDraw();
}

BOOL Mthd_IsDelete(void* i_this) {
return static_cast<Act_c*>(i_this)->MoveBGIsDelete();
}

static actor_method_class Mthd_Table = {
(process_method_func)Mthd_Create,
(process_method_func)Mthd_Delete,
(process_method_func)Mthd_Execute,
(process_method_func)Mthd_IsDelete,
(process_method_func)Mthd_Draw,
};
}
}

actor_process_profile_definition g_profile_Obj_Ojtree = {
/* LayerID */ fpcLy_CURRENT_e,
/* ListID */ 3,
/* ListPrio */ fpcLy_CURRENT_e,
/* ProcName */ PROC_Obj_Ojtree,
/* Proc SubMtd */ &g_fpcLf_Method.mBase,
/* Size */ sizeof(daObjOjtree::Act_c),
/* SizeOther */ 0,
/* Parameters */ 0,
/* Leaf SubMtd */ &g_fopAc_Method.base,
/* Priority */ 0x002D,
/* Actor SubMtd */ &daObjOjtree::Mthd_Table,
/* Status */ fopAcStts_UNK40000_e | fopAcStts_CULL_e | fopAcStts_NOCULLEXEC_e,
/* Group */ fopAc_ACTOR_e,
/* CullType */ fopAc_CULLBOX_CUSTOM_e,
};
Loading