Skip to content

Commit

Permalink
d_a_obj_Ygush00 almost
Browse files Browse the repository at this point in the history
  • Loading branch information
magcius committed Sep 13, 2023
1 parent 8f4ec8a commit 44c3902
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 25 deletions.
5 changes: 3 additions & 2 deletions include/f_op/f_op_actor_mng.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)) { \
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions include/m_Do/m_Do_audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
5 changes: 1 addition & 4 deletions include/m_Do/m_Do_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ class mDoExt_btkAnm : public mDoExt_baseAnm {

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()); }
Expand Down
42 changes: 23 additions & 19 deletions src/d/actor/d_a_obj_Ygush00.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ struct daObjYgush00_c : public fopAc_ac_c {
};

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:
request_of_phase_process_class mPhs;
J3DModel * mpModel;
mDoExt_btkAnm mBtkAnm;
mDoExt_bckAnm mBckAnm;
u32 mType;
s32 mType;
daObjGryw00_c * mpGryw00;
};

Expand All @@ -51,20 +51,20 @@ 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]);
J3DAnmTransform * pBck = (J3DAnmTransform *)dComIfG_getObjectRes(l_arcname, bck_table[mType]);

if (!pModelData || !pBtk || !pBck) {
JUT_ASSERT(207, 0);
ret = 0;
ret = false;
return ret;
}

Expand All @@ -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)) {
Expand All @@ -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());
Expand All @@ -102,39 +102,43 @@ 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();
}

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());
Expand Down

0 comments on commit 44c3902

Please sign in to comment.