diff --git a/configure.py b/configure.py index f8515c074..8ecc6b8d8 100755 --- a/configure.py +++ b/configure.py @@ -1688,7 +1688,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_obj_plant"), ActorRel(NonMatching, "d_a_obj_rflw"), ActorRel(Matching, "d_a_obj_rforce"), - ActorRel(NonMatching, "d_a_obj_smplbg"), + ActorRel(Matching, "d_a_obj_smplbg", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_tapestry"), ActorRel(NonMatching, "d_a_obj_tntrap"), ActorRel(Matching, "d_a_obj_tower"), diff --git a/include/d/actor/d_a_obj_smplbg.h b/include/d/actor/d_a_obj_smplbg.h index 1498561dc..28f63a21a 100644 --- a/include/d/actor/d_a_obj_smplbg.h +++ b/include/d/actor/d_a_obj_smplbg.h @@ -2,16 +2,43 @@ #define D_A_OBJ_SMPLBG_H #include "d/d_bg_s_movebg_actor.h" +#include "d/d_a_obj.h" +#include "d/d_bg_w.h" namespace daObjSmplbg { class Act_c : public dBgS_MoveBgActor { public: - void attr() const {} + + enum Prm_e { + PRM_TYPE_W = 8, + PRM_TYPE_S = 0, + }; + + static Mtx M_tmp_mtx; + struct Attr_c { + /* 0x00 */ u32 mHeapSize; + /* 0x04 */ const char* mResName; + /* 0x08 */ short mBDLFileIndex; + /* 0x0A */ short mDZBFileIndex; + /* 0x0C */ MoveBGActor_SetFunc mMoveBGProc; + /* 0x10 */ u32 mFlags; + /* 0x14 */ short mCullMinX; + /* 0x16 */ short mCullMinY; + /* 0x18 */ short mCullMinZ; + /* 0x1A */ short mCullMaxX; + /* 0x1C */ short mCullMaxY; + /* 0x1E */ short mCullMaxZ; + /* 0x20 */ float mEyeOffset; + }; + + static const Attr_c M_attr[1]; + inline const Attr_c& attr() const { return M_attr[mType]; } + void isStop() {} void offStop() {} void onStop() {} - void prm_get_type() const {} - + int prm_get_type() const { return daObj::PrmAbstract(this, PRM_TYPE_W , PRM_TYPE_S);} + virtual BOOL CreateHeap(); virtual BOOL Create(); cPhs_State Mthd_Create(); @@ -24,8 +51,12 @@ namespace daObjSmplbg { virtual BOOL Draw(); public: - /* Place member variables here */ - }; + /* 0x2C8 */ request_of_phase_process_class mPhs; + /* 0x2D0 */ J3DModel* mpModel; + /* 0x2D4 */ int mType; + /* 0x2D8 */ u8 field_0x2D8; + /* 0x2D9 */ u8 field_0x2D9[0x2DC - 0x2D9]; + }; // Size: 0x2DC }; #endif /* D_A_OBJ_SMPLBG_H */ diff --git a/src/d/actor/d_a_obj_smplbg.cpp b/src/d/actor/d_a_obj_smplbg.cpp index e1ecdfa67..09714c4ad 100644 --- a/src/d/actor/d_a_obj_smplbg.cpp +++ b/src/d/actor/d_a_obj_smplbg.cpp @@ -5,82 +5,159 @@ #include "d/actor/d_a_obj_smplbg.h" #include "d/d_procname.h" +#include "d/d_com_inf_game.h" +#include "d/res/res_qtkhd.h" +const daObjSmplbg::Act_c::Attr_c daObjSmplbg::Act_c::M_attr[1] = { + /* mHeapSize */ 0x000015E0, + /* mResName */ "Qtkhd", + /* mBDLFileIndex */ QTKHD_BDL_QTKHD, + /* mDZBFileIndex */ QTKHD_DZB_QTKHD, + /* mMoveBGProc */ dBgS_MoveBGProc_TypicalRotY, + /* mFlags */ 13, + /* mCullMinX */ 0, + /* mCullMinY */ 2250, + /* mCullMinZ */ 0, + /* mCullMaxX */ 750, + /* mCullMaxY */ 0, + /* mCullMaxZ */ 0, + /* mEyeOffset */ 1687.0f +}; +Mtx daObjSmplbg::Act_c::M_tmp_mtx; /* 00000078-00000144 .text CreateHeap__Q211daObjSmplbg5Act_cFv */ BOOL daObjSmplbg::Act_c::CreateHeap() { - /* Nonmatching */ + J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(attr().mResName, attr().mBDLFileIndex); + JUT_ASSERT(0x6b, model_data != NULL); + mpModel = mDoExt_J3DModel__create(model_data, 0x80000,0x11000022); + return mpModel != NULL; } /* 00000144-0000032C .text Create__Q211daObjSmplbg5Act_cFv */ BOOL daObjSmplbg::Act_c::Create() { - /* Nonmatching */ + cullMtx = mpModel->getBaseTRMtx(); + fopAcM_SetMtx(this, cullMtx); + init_mtx(); + eyePos.y += attr().mEyeOffset; + + if(((attr().mFlags) & 8) != 0){ + fopAcM_OffStatus(this, fopAcStts_NOCULLEXEC_e); + } + if(((attr().mFlags) & 4) != 0){ + cullType = 23; + fopAcM_setCullSizeSphere(this, attr().mCullMinX, attr().mCullMinY, attr().mCullMinZ, attr().mCullMaxX); + + } else{ + cullType = 14; + fopAcM_setCullSizeBox(this, attr().mCullMinX, attr().mCullMinY, attr().mCullMinZ, attr().mCullMaxX, attr().mCullMaxY, attr().mCullMaxZ); + } + return TRUE; } /* 0000032C-00000474 .text Mthd_Create__Q211daObjSmplbg5Act_cFv */ cPhs_State daObjSmplbg::Act_c::Mthd_Create() { - /* Nonmatching */ + + fopAcM_SetupActor(this, Act_c); + mType = prm_get_type(); + if(mType >= 1){ + mType = 0; + } + cPhs_State phase_state = dComIfG_resLoad(&mPhs, attr().mResName); + if(phase_state == cPhs_COMPLEATE_e){ + phase_state = MoveBGCreate(attr().mResName, attr().mDZBFileIndex, attr().mMoveBGProc, attr().mHeapSize); + JUT_ASSERT(181, (phase_state == cPhs_COMPLEATE_e) || (phase_state == cPhs_ERROR_e)); + } + return phase_state; } /* 00000474-0000047C .text Delete__Q211daObjSmplbg5Act_cFv */ BOOL daObjSmplbg::Act_c::Delete() { - /* Nonmatching */ + return TRUE; } /* 0000047C-000004D8 .text Mthd_Delete__Q211daObjSmplbg5Act_cFv */ BOOL daObjSmplbg::Act_c::Mthd_Delete() { - /* Nonmatching */ + s32 result = MoveBGDelete(); + dComIfG_resDelete(&mPhs, attr().mResName); + return result; } /* 000004D8-00000558 .text set_mtx__Q211daObjSmplbg5Act_cFv */ void daObjSmplbg::Act_c::set_mtx() { - /* Nonmatching */ + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + cMtx_copy(mDoMtx_stack_c::now, M_tmp_mtx); } /* 00000558-00000594 .text init_mtx__Q211daObjSmplbg5Act_cFv */ void daObjSmplbg::Act_c::init_mtx() { - /* Nonmatching */ + mpModel->mBaseScale = scale; + set_mtx(); } /* 00000594-0000061C .text exec_qtkhd__Q211daObjSmplbg5Act_cFv */ void daObjSmplbg::Act_c::exec_qtkhd() { - /* Nonmatching */ + if(field_0x2D8 == 0){ + shape_angle.y += 0x5b; + fopAcM_seStart(this, JA_SE_OBJ_TC_TOWER_ROUND, 0); + } } /* 0000061C-000006CC .text Execute__Q211daObjSmplbg5Act_cFPPA3_A4_f */ -BOOL daObjSmplbg::Act_c::Execute(Mtx**) { - /* Nonmatching */ +BOOL daObjSmplbg::Act_c::Execute(Mtx** matrix) { + typedef void (daObjSmplbg::Act_c::*procFunc)(); + static procFunc exec_proc[] = { + &daObjSmplbg::Act_c::exec_qtkhd, + }; + (this->*exec_proc[mType])(); + + set_mtx(); + *matrix = &M_tmp_mtx; + return TRUE; } /* 000006CC-00000764 .text Draw__Q211daObjSmplbg5Act_cFv */ BOOL daObjSmplbg::Act_c::Draw() { - /* Nonmatching */ + int tevType; + if (((attr().mFlags) & 1) != 0) { + tevType = TEV_TYPE_BG0; + } else if (((attr().mFlags) & 2) != 0) { + tevType = TEV_TYPE_BG1; + } + else { + tevType = TEV_TYPE_ACTOR; + } + g_env_light.settingTevStruct(tevType, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType(mpModel, &tevStr); + mDoExt_modelUpdateDL(mpModel); + return TRUE; } namespace daObjSmplbg { namespace { /* 00000764-00000784 .text Mthd_Create__Q211daObjSmplbg28@unnamed@d_a_obj_smplbg_cpp@FPv */ -cPhs_State Mthd_Create(void*) { - /* Nonmatching */ +cPhs_State Mthd_Create(void* i_this) { + return ((Act_c*)i_this)->Mthd_Create(); } /* 00000784-000007A4 .text Mthd_Delete__Q211daObjSmplbg28@unnamed@d_a_obj_smplbg_cpp@FPv */ -BOOL Mthd_Delete(void*) { - /* Nonmatching */ +BOOL Mthd_Delete(void* i_this) { + return ((Act_c*)i_this)->Mthd_Delete(); } /* 000007A4-000007C4 .text Mthd_Execute__Q211daObjSmplbg28@unnamed@d_a_obj_smplbg_cpp@FPv */ -BOOL Mthd_Execute(void*) { - /* Nonmatching */ +BOOL Mthd_Execute(void* i_this) { + return ((Act_c*)i_this)->MoveBGExecute(); } /* 000007C4-000007F0 .text Mthd_Draw__Q211daObjSmplbg28@unnamed@d_a_obj_smplbg_cpp@FPv */ -BOOL Mthd_Draw(void*) { - /* Nonmatching */ +BOOL Mthd_Draw(void* i_this) { + return ((Act_c*)i_this)->Draw(); } /* 000007F0-0000081C .text Mthd_IsDelete__Q211daObjSmplbg28@unnamed@d_a_obj_smplbg_cpp@FPv */ -BOOL Mthd_IsDelete(void*) { - /* Nonmatching */ +BOOL Mthd_IsDelete(void* i_this) { + return ((Act_c*)i_this)->IsDelete(); } static actor_method_class Mthd_Table = {