From 44c39026c06f225b28518abc2afe5f168b6c140e Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 13 Sep 2023 15:33:56 -0700 Subject: [PATCH] d_a_obj_Ygush00 almost --- include/f_op/f_op_actor_mng.h | 5 ++-- include/m_Do/m_Do_audio.h | 4 ++++ include/m_Do/m_Do_ext.h | 5 +--- src/d/actor/d_a_obj_Ygush00.cpp | 42 ++++++++++++++++++--------------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 02318cd94..a2f07e5b2 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -5,6 +5,7 @@ #include "f_op/f_op_actor_iter.h" #include "f_pc/f_pc_manager.h" #include "f_pc/f_pc_searcher.h" +#include "m_Do/m_Do_audio.h" #define fopAcM_SetupActor(ptr,ClassName) \ if (!fopAcM_CheckCondition(ptr, fopAcCnd_INIT_e)) { \ @@ -604,9 +605,9 @@ inline f32 fopAcM_searchPlayerDistance(const fopAc_ac_c* actor) { s8 dComIfGp_getReverb(int roomNo); -inline void fopAcM_seStartCurrent(const fopAc_ac_c* actor, u32 sfxID, u32 param_2) { +inline void fopAcM_seStartCurrent(fopAc_ac_c* actor, u32 sfxID, u32 param_2) { s8 roomNo = fopAcM_GetRoomNo(actor); - // mDoAud_seStart(sfxID, &actor->current.pos, param_2, dComIfGp_getReverb(roomNo)); + mDoAud_seStart(sfxID, &actor->current.pos, param_2, dComIfGp_getReverb(roomNo)); } inline void fopAcM_seStart(const fopAc_ac_c* actor, u32 sfxID, u32 param_2) { diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h index 6a4b643fa..79f1da81e 100644 --- a/include/m_Do/m_Do_audio.h +++ b/include/m_Do/m_Do_audio.h @@ -43,4 +43,8 @@ inline void mDoAud_resetProcess() { } } +inline void mDoAud_seStart(u32 i_sfxID, Vec* i_sePos, u32 param_2, s8 i_reverb) { + JAIZelBasic::getInterface()->seStart(i_sfxID, i_sePos, param_2, i_reverb, 1.0f, 1.0f, -1.0f, -1.0f, 0); +} + #endif /* M_DO_AUDIO_H */ diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 747c1a007..ecfbd0d41 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -51,10 +51,7 @@ public: void entry(J3DModelData* i_modelData) { entry(i_modelData, getFrame()); } int init(J3DModelData* i_modelData, J3DAnmTextureSRTKey* i_btk, int i_anmPlay, int i_attribute, - f32 i_rate, s16 i_start, s16 i_end, bool i_modify, bool i_entry) { - return init(&i_modelData->getMaterialTable(), i_btk, i_anmPlay, i_attribute, i_rate, - i_start, i_end, i_modify, i_entry); - } + f32 i_rate, s16 i_start, s16 i_end, bool i_modify, bool i_entry); int remove(J3DModelData* i_modelData) { return i_modelData->removeTexMtxAnimator(mpAnm); } void entryFrame() { entryFrame(getFrame()); } diff --git a/src/d/actor/d_a_obj_Ygush00.cpp b/src/d/actor/d_a_obj_Ygush00.cpp index 531562aff..de58d71fd 100644 --- a/src/d/actor/d_a_obj_Ygush00.cpp +++ b/src/d/actor/d_a_obj_Ygush00.cpp @@ -26,10 +26,10 @@ public: }; s32 _create(); - s32 _delete(); - s32 _execute(); - s32 _draw(); - s32 create_heap(); + bool _delete(); + bool _execute(); + bool _draw(); + bool create_heap(); static s32 solidHeapCB(fopAc_ac_c*); public: @@ -37,7 +37,7 @@ public: J3DModel * mpModel; mDoExt_btkAnm mBtkAnm; mDoExt_bckAnm mBckAnm; - u32 mType; + s32 mType; daObjGryw00_c * mpGryw00; }; @@ -51,12 +51,12 @@ s32 daObjYgush00_c::solidHeapCB(fopAc_ac_c* ac) { } /* 0000009C-00000250 .text create_heap__14daObjYgush00_cFv */ -s32 daObjYgush00_c::create_heap() { +bool daObjYgush00_c::create_heap() { static u32 mdl_table[] = { 0x0A, 0x09, 0x09, 0x09 }; static u32 btk_table[] = { 0x0E, 0x0D, 0x0D, 0x0D }; static u32 bck_table[] = { 0x06, 0x05, 0x05, 0x05 }; - s32 ret = 1; + bool ret = true; J3DModelData * pModelData = (J3DModelData *)dComIfG_getObjectRes(l_arcname, mdl_table[mType]); J3DAnmTextureSRTKey * pBtk = (J3DAnmTextureSRTKey *)dComIfG_getObjectRes(l_arcname, btk_table[mType]); @@ -64,7 +64,7 @@ s32 daObjYgush00_c::create_heap() { if (!pModelData || !pBtk || !pBck) { JUT_ASSERT(207, 0); - ret = 0; + ret = false; return ret; } @@ -73,15 +73,13 @@ s32 daObjYgush00_c::create_heap() { s32 bckRet = mBckAnm.init(pModelData, pBck, true, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, false); if (!mpModel || !btkRet || !bckRet) - ret = 0; + ret = false; return ret; } /* 00000250-000003F4 .text _create__14daObjYgush00_cFv */ s32 daObjYgush00_c::_create() { - const char * arcname = l_arcname; - fopAcM_SetupActor(this, daObjYgush00_c); if (fpcM_IsFirstCreating(this)) { @@ -91,7 +89,9 @@ s32 daObjYgush00_c::_create() { mType = 0; } - if (dComIfG_resLoad(&mPhs, arcname) == cPhs_COMPLEATE_e) { + s32 ret = dComIfG_resLoad(&mPhs, l_arcname); + + if (ret == cPhs_COMPLEATE_e) { if (fopAcM_entrySolidHeap(this, (heapCallbackFunc)solidHeapCB, 0x740) == 1) { mpModel->setBaseScale(mScale); mDoMtx_stack_c::transS(getPosition()); @@ -102,20 +102,22 @@ s32 daObjYgush00_c::_create() { mScale.x * -80.0f, 0.0f, mScale.z * -80.0f, mScale.x * 80.0f, mScale.y * 125.0f, mScale.z * 80.0f); } else { - return cPhs_ERROR_e; + ret = cPhs_ERROR_e; } } + + return ret; } /* 000004F4-00000524 .text _delete__14daObjYgush00_cFv */ -s32 daObjYgush00_c::_delete() { +bool daObjYgush00_c::_delete() { dComIfG_resDelete(&mPhs, l_arcname); return 1; } /* 00000524-0000066C .text _execute__14daObjYgush00_cFv */ -s32 daObjYgush00_c::_execute() { - if (mType != 3 || dComIfGs_isEventBit(EV_BIT_TALKED_TO_IRCH_IN_FOREST_HAVEN)) { +bool daObjYgush00_c::_execute() { + if (mType != 3 || dComIfGs_isEventBit(EV_BIT_TALKED_TO_IRCH_IN_FOREST_HAVEN) == 1) { mBtkAnm.play(); mBckAnm.play(); } @@ -123,18 +125,20 @@ s32 daObjYgush00_c::_execute() { if (mType == 1) { if (mpGryw00 != NULL) { if (mpGryw00->get_draw_water_lvl(mpGryw00) <= getPosition().y) { - // fopAcM_seStartCurrent(this, 0x61fe, 0); + fopAcM_seStartCurrent(this, 0x61fe, 0); } } else { mpGryw00 = (daObjGryw00_c*)i_fopAcM_SearchByName(PROC_Obj_Gryw00); } } else { - // fopAcM_seStartCurrent(this, 0x61fe, 0); + fopAcM_seStartCurrent(this, 0x61fe, 0); } + + return TRUE; } /* 0000066C-000006FC .text _draw__14daObjYgush00_cFv */ -s32 daObjYgush00_c::_draw() { +bool daObjYgush00_c::_draw() { g_env_light.settingTevStruct(TEV_TYPE_BG1, getPositionP(), &mTevStr); g_env_light.setLightTevColorType(mpModel, &mTevStr); mBtkAnm.entry(mpModel->getModelData());