From f65adb0f972632140ddd9ff1fccb84b58661eb35 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 22 Sep 2023 10:58:13 -0700 Subject: [PATCH] f_op_camera seems good --- configure.py | 2 +- include/d/d_com_inf_game.h | 9 +++ include/d/d_demo.h | 8 ++- include/d/d_event.h | 2 +- include/d/d_s_play.h | 2 +- include/f_op/f_op_actor.h | 2 +- include/f_op/f_op_camera.h | 26 ++++++-- include/m_Do/m_Do_audio.h | 4 ++ src/f_op/f_op_actor.cpp | 129 ++++++++++++++++++++++++++----------- src/f_op/f_op_camera.cpp | 69 +++++++++++++++++--- src/f_op/f_op_kankyo.cpp | 2 +- src/f_op/f_op_msg.cpp | 10 +-- 12 files changed, 203 insertions(+), 62 deletions(-) diff --git a/configure.py b/configure.py index 8ee0a6702..7f581f2c4 100644 --- a/configure.py +++ b/configure.py @@ -272,7 +272,7 @@ config.libs = [ Object(Matching, "f_op/f_op_actor_iter.cpp"), Object(Matching, "f_op/f_op_actor_tag.cpp"), Object(NonMatching, "f_op/f_op_actor_mng.cpp"), - Object(NonMatching, "f_op/f_op_camera.cpp"), + Object(Matching, "f_op/f_op_camera.cpp"), Object(Matching, "f_op/f_op_camera_mng.cpp"), Object(Matching, "f_op/f_op_overlap.cpp"), Object(Matching, "f_op/f_op_overlap_mng.cpp"), diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 5b2677374..a886bef1f 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -36,6 +36,7 @@ class daAgb_c; class dTimer_c; class camera_class; class J2DOrthoGraph; +class dDemo_actor_c; class __d_timer_info_c { public: @@ -948,6 +949,10 @@ inline void dComIfGp_demo_update() { g_dComIfG_gameInfo.play.getDemo()->update(); } +inline dDemo_actor_c* dComIfGp_demo_getActor(u8 id) { + return g_dComIfG_gameInfo.play.getDemo()->mDemoObj.getActor(id); +} + inline void dComIfGp_setLkDemoAnmArchive(JKRArchive* i_arc) { g_dComIfG_gameInfo.play.setLkDemoAnmArchive(i_arc); } @@ -1051,6 +1056,10 @@ inline void dComIfGp_event_setItemPartnerId(u32 id) { return g_dComIfG_gameInfo.play.getEvent().setPtI_Id(id); } +inline s32 dComIfGp_event_moveApproval(void* actor) { + return g_dComIfG_gameInfo.play.getEvent().moveApproval(actor); +} + inline dEvent_manager_c& dComIfGp_getEventManager() { return g_dComIfG_gameInfo.play.getEvtManager(); } diff --git a/include/d/d_demo.h b/include/d/d_demo.h index aad241265..2484031df 100644 --- a/include/d/d_demo.h +++ b/include/d/d_demo.h @@ -10,6 +10,12 @@ class dDemo_light_c; class dDemo_system_c; class TControl; class dMesg_tControl; +class fopAc_ac_c; + +class dDemo_actor_c /* : public JStage::TActor */ { +public: + void setActor(fopAc_ac_c*); +}; class dDemo_object_c { public: @@ -17,7 +23,7 @@ public: ~dDemo_object_c(); void appendActor(fopAc_ac_c*); - void getActor(u8); + dDemo_actor_c* getActor(u8); void createCamera(); void getActiveCamera(); void createAmbient(); diff --git a/include/d/d_event.h b/include/d/d_event.h index 3d78feba9..c1dd57301 100644 --- a/include/d/d_event.h +++ b/include/d/d_event.h @@ -48,7 +48,7 @@ public: void soundProc(); void check(); void photoCheck(); - void moveApproval(void*); + s32 moveApproval(void*); void compulsory(void*, const char*, u16); void remove(); void getStageEventDt(); diff --git a/include/d/d_s_play.h b/include/d/d_s_play.h index 463d66306..8a5479c96 100644 --- a/include/d/d_s_play.h +++ b/include/d/d_s_play.h @@ -12,7 +12,7 @@ public: bool resetGame(); void offReset(); - static bool isPause() { return pauseTimer == 0; } + static bool isPause() { return pauseTimer != 0; } static void setPauseTimer(s8 time) { pauseTimer = time; } static s8 pauseTimer; diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index 05a0bfca8..764bfe8aa 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -17,7 +17,7 @@ struct actor_method_class { enum fopAc_Status_e { fopAcStts_SHOWMAP_e = 0x00000020, fopAcStts_NOEXEC_e = 0x00000080, - fopAcStts_CULLSTOP_e = 0x00000100, + fopAcStts_CULL_e = 0x00000100, fopAcStts_FREEZE_e = 0x00000400, fopAcStts_CARRY_e = 0x00002000, fopAcStts_NOPAUSE_e = 0x00020000, diff --git a/include/f_op/f_op_camera.h b/include/f_op/f_op_camera.h index 9ae93e4b5..c9504450f 100644 --- a/include/f_op/f_op_camera.h +++ b/include/f_op/f_op_camera.h @@ -2,16 +2,32 @@ #define F_F_OP_CAMERA_H_ #include "f_op/f_op_view.h" +#include "SSystem/SComponent/c_sxyz.h" +#include "SSystem/SComponent/c_phase.h" -class camera_class; +class camera_process_class : public view_class { +public: + /* 0x210 */ create_tag_class mDwTg; + /* 0x224 */ leafdraw_method_class* mpMtd; + /* 0x228 */ u8 field_0x228[4]; + /* 0x22C */ s8 mPrm1; + /* 0x22D */ s8 mPrm2; + /* 0x22E */ s8 mPrm3; + /* 0x22F */ s8 field_0x22f; + /* 0x230 */ csXyz mAngle; + /* 0x238 */ int field_0x238; +}; + +class camera_class : public camera_process_class { +public: + /* 0x23C */ int field_0x23c; + /* 0x240 */ request_of_phase_process_class mPhaseReq; + // /* 0x248 */ dCamera_c mCamera; +}; struct camera_process_profile_definition { /* 0x00 */ view_process_profile_definition mBase; /* 0x3C */ leafdraw_method_class* mSubMtd; // Subclass methods }; -static s32 fopCam_Draw(camera_class* param_1); -static int fopCam_Execute(camera_class* pCamera); -int fopCam_IsDelete(camera_class* pCamera); - #endif diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h index b76f75646..f53339662 100644 --- a/include/m_Do/m_Do_audio.h +++ b/include/m_Do/m_Do_audio.h @@ -62,6 +62,10 @@ inline void mDoAud_seStart(u32 i_sfxID, Vec* i_sePos, u32 param_2, s8 i_reverb) mDoAud_zelAudio_c::getInterface()->seStart(i_sfxID, i_sePos, param_2, i_reverb, 1.0f, 1.0f, -1.0f, -1.0f, 0); } +inline void mDoAud_seDeleteObject(Vec* i_sePos) { + mDoAud_zelAudio_c::getInterface()->seDeleteObject(i_sePos); +} + inline void mDoAud_bgmMuteMtDragon() { mDoAud_zelAudio_c::getInterface()->bgmMuteMtDragon(); } diff --git a/src/f_op/f_op_actor.cpp b/src/f_op/f_op_actor.cpp index b7dc73c9a..6e5ad7b05 100644 --- a/src/f_op/f_op_actor.cpp +++ b/src/f_op/f_op_actor.cpp @@ -4,64 +4,121 @@ // #include "f_op/f_op_actor.h" -#include "dolphin/types.h" +#include "f_op/f_op_actor_mng.h" +#include "f_op/f_op_actor_tag.h" +#include "f_op/f_op_draw_tag.h" +#include "f_pc/f_pc_leaf.h" +#include "d/d_demo.h" +#include "d/d_map.h" +#include "d/d_meter.h" +#include "d/d_com_inf_game.h" +#include "d/d_s_play.h" /* 8002330C-800233C4 .text __ct__10fopAc_ac_cFv */ fopAc_ac_c::fopAc_ac_c() { - /* Nonmatching */ } -/* 800233C4-80023400 .text __dt__20fopAc_cullSizeSphereFv */ -fopAc_cullSizeSphere::~fopAc_cullSizeSphere() { - /* Nonmatching */ -} - -/* 80023400-8002343C .text __dt__17fopAc_cullSizeBoxFv */ -fopAc_cullSizeBox::~fopAc_cullSizeBox() { - /* Nonmatching */ -} - -/* 8002343C-80023478 .text __dt__12dKy_tevstr_cFv */ -dKy_tevstr_c::~dKy_tevstr_c() { - /* Nonmatching */ -} - -/* 80023478-800234C0 .text __dt__11dEvt_info_cFv */ -dEvt_info_c::~dEvt_info_c() { - /* Nonmatching */ -} - -/* 800234C0-80023514 .text __dt__10fopAc_ac_cFv */ -fopAc_ac_c::~fopAc_ac_c() { - /* Nonmatching */ -} +int g_fopAc_type; +u32 fopAc_ac_c::stopStatus; /* 80023514-80023540 .text fopAc_IsActor__FPv */ -void fopAc_IsActor(void*) { - /* Nonmatching */ +s32 fopAc_IsActor(void* pProc) { + return fpcBs_Is_JustOfType(g_fopAc_type, ((fopAc_ac_c*)pProc)->mAcType); } +extern void drawActorPointMiniMap(fopAc_ac_c*); + /* 80023540-8002362C .text fopAc_Draw__FPv */ -void fopAc_Draw(void*) { - /* Nonmatching */ +void fopAc_Draw(void* pProc) { + if (dMenu_flag()) + return; + + fopAc_ac_c * actor = (fopAc_ac_c *)pProc; + if ((dComIfGp_event_moveApproval(pProc) == 2 || !fopAcM_checkStatus(actor, fopAc_ac_c::stopStatus)) && + (!fopAcM_checkStatus(actor, fopAcStts_CULL_e) || fopAcM_cullingCheck(actor)) && + !fopAcM_checkStatus(actor, fopAcStts_NODRAW_e)) { + fopAcM_OffCondition(actor, fopAcCnd_NODRAW_e); + fpcLf_DrawMethod(actor->mpDrawMtd, actor); + } else { + fopAcM_OnCondition(actor, fopAcCnd_NODRAW_e); + } + + fopAcM_OffStatus(actor, fopAcStts_NODRAW_e); + + if (dComIfGp_roomControl_getStayNo() >= 0 && fopAcM_checkStatus(actor, fopAcStts_SHOWMAP_e)) + drawActorPointMiniMap(actor); } +#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1)); +#define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f) + /* 8002362C-80023BDC .text fopAc_Execute__FPv */ -void fopAc_Execute(void*) { - /* Nonmatching */ +s32 fopAc_Execute(void* pProc) { + fopAc_ac_c * actor = (fopAc_ac_c *)pProc; + s32 ret = TRUE; + + CHECK_FLOAT_CLASS(0x27d, actor->current.pos.x); + CHECK_FLOAT_CLASS(0x27e, actor->current.pos.y); + CHECK_FLOAT_CLASS(0x27f, actor->current.pos.z); + CHECK_VEC3_RANGE(0x286, actor->current.pos); + + if (fopAcM_checkStatus(actor, fopAcStts_NOPAUSE_e) || (!dMenu_flag() && !dScnPly_ply_c::isPause())) { + actor->mEvtInfo.setCondition(dEvtCnd_NONE_e); + + s32 moveApproval = dComIfGp_event_moveApproval(actor); + if (moveApproval == 2 || (moveApproval != 0 && !fopAcM_checkStatus(actor, fopAc_ac_c::stopStatus)) && + !fopAcM_checkStatus(actor, fopAcStts_NOEXEC_e) || !fopAcM_CheckCondition(actor, fopAcStts_NODRAW_e)) { + fopAcM_OffCondition(actor, fopAcCnd_NOEXEC_e); + actor->next = actor->current; + ret = fpcMtd_Execute((process_method_class*)actor->mSubMtd, actor); + } else { + fopAcM_OnCondition(actor, fopAcCnd_NOEXEC_e); + } + + CHECK_FLOAT_CLASS(0x2b4, actor->current.pos.x); + CHECK_FLOAT_CLASS(0x2b5, actor->current.pos.y); + CHECK_FLOAT_CLASS(0x2b6, actor->current.pos.z); + CHECK_VEC3_RANGE(0x2bd, actor->current.pos); + } + + return ret; } /* 80023BDC-80023C30 .text fopAc_IsDelete__FPv */ -void fopAc_IsDelete(void*) { - /* Nonmatching */ +s32 fopAc_IsDelete(void* pProc) { + fopAc_ac_c * actor = (fopAc_ac_c *)pProc; + s32 ret = fpcMtd_IsDelete((process_method_class*)actor->mSubMtd, actor); + if (ret == 1) + fopDwTg_DrawQTo(&actor->mDwTg); + return ret; } /* 80023C30-80023CD4 .text fopAc_Delete__FPv */ -void fopAc_Delete(void*) { - /* Nonmatching */ +s32 fopAc_Delete(void* pProc) { + fopAc_ac_c * actor = (fopAc_ac_c *)pProc; + s32 ret = fpcMtd_Delete((process_method_class*)actor->mSubMtd, actor); + if (ret == 1) { + fopAcTg_ActorQTo(&actor->mAcTg); + fopDwTg_DrawQTo(&actor->mDwTg); + fopAcM_DeleteHeap(actor); + dDemo_actor_c *pDemoActor = dComIfGp_demo_getActor(actor->mDemoActorId); + if (pDemoActor != NULL) + pDemoActor->setActor(NULL); + mDoAud_seDeleteObject(&actor->mEyePos); + mDoAud_seDeleteObject(&actor->current.pos); + } + return ret; } /* 80023CD4-80023F78 .text fopAc_Create__FPv */ void fopAc_Create(void*) { /* Nonmatching */ } + +actor_method_class g_fopAc_Method = { + (process_method_func)fopAc_Create, + (process_method_func)fopAc_Delete, + (process_method_func)fopAc_Execute, + (process_method_func)fopAc_IsDelete, + (process_method_func)fopAc_Draw, +}; diff --git a/src/f_op/f_op_camera.cpp b/src/f_op/f_op_camera.cpp index 7463b4018..ec8416fa4 100644 --- a/src/f_op/f_op_camera.cpp +++ b/src/f_op/f_op_camera.cpp @@ -4,29 +4,78 @@ // #include "f_op/f_op_camera.h" +#include "f_op/f_op_draw_tag.h" #include "dolphin/types.h" +#include "d/d_meter.h" +#include "d/d_s_play.h" /* 80029278-800292CC .text fopCam_Draw__FP12camera_class */ -void fopCam_Draw(camera_class*) { - /* Nonmatching */ +s32 fopCam_Draw(camera_class* camera) { + s32 cam_proc = 1; + + if (!dMenu_flag()) { + cam_proc = fpcLf_DrawMethod(camera->mpMtd, camera); + } + return cam_proc; } /* 800292CC-80029328 .text fopCam_Execute__FP12camera_class */ -void fopCam_Execute(camera_class*) { - /* Nonmatching */ +s32 fopCam_Execute(camera_class* camera) { + int ret; + + if (!dMenu_flag() && !dScnPly_ply_c::isPause()) { + ret = fpcMtd_Execute((process_method_class*)camera->mpMtd, camera); + } + + return ret; } /* 80029328-8002937C .text fopCam_IsDelete__FP12camera_class */ -void fopCam_IsDelete(camera_class*) { - /* Nonmatching */ +s32 fopCam_IsDelete(camera_class* camera) { + s32 ret = fpcMtd_IsDelete((process_method_class*)camera->mpMtd, camera); + if (ret == 1) + fopDwTg_DrawQTo(&camera->mDwTg); + return ret; } /* 8002937C-800293D0 .text fopCam_Delete__FP12camera_class */ -void fopCam_Delete(camera_class*) { - /* Nonmatching */ +s32 fopCam_Delete(camera_class* camera) { + s32 ret = fpcMtd_Delete((process_method_class*)camera->mpMtd, camera); + if (ret == 1) + fopDwTg_DrawQTo(&camera->mDwTg); + return ret; } /* 800293D0-80029468 .text fopCam_Create__FPv */ -void fopCam_Create(void*) { - /* Nonmatching */ +s32 fopCam_Create(void* pProc) { + camera_class* camera = (camera_class*)pProc; + + if (fpcM_IsFirstCreating(pProc)) { + camera_process_profile_definition* profile = + (camera_process_profile_definition*)fpcM_GetProfile(pProc); + camera->mpMtd = profile->mSubMtd; + + fopDwTg_Init(&camera->mDwTg, camera); + u32* append = (u32*)fpcM_GetAppend(camera); + + if (append) { + fpcM_SetParam(camera, *append); + } + } + + s32 ret = fpcMtd_Create(&camera->mpMtd->mBase, camera); + if (ret == cPhs_COMPLEATE_e) { + s32 priority = fpcLf_GetPriority(camera); + fopDwTg_ToDrawQ(&camera->mDwTg, priority); + } + + return ret; } + +leafdraw_method_class g_fopCam_Method = { + (process_method_func)fopCam_Create, + (process_method_func)fopCam_Delete, + (process_method_func)fopCam_Execute, + (process_method_func)fopCam_IsDelete, + (process_method_func)fopCam_Draw, +}; diff --git a/src/f_op/f_op_kankyo.cpp b/src/f_op/f_op_kankyo.cpp index bd49d96a0..983496604 100644 --- a/src/f_op/f_op_kankyo.cpp +++ b/src/f_op/f_op_kankyo.cpp @@ -29,7 +29,7 @@ static int fopKy_Execute(void* i_this) { int ret; kankyo_class* _this = (kankyo_class*)i_this; - if (dScnPly_ply_c::isPause() && (!dMenu_flag() || fpcM_GetName(i_this) == PROC_ENVSE || fpcM_GetName(i_this) == PROC_LEVEL_SE)) { + if (!dScnPly_ply_c::isPause() && (!dMenu_flag() || fpcM_GetName(i_this) == PROC_ENVSE || fpcM_GetName(i_this) == PROC_LEVEL_SE)) { ret = fpcMtd_Execute(&_this->mSubMtd->mBase, i_this); } diff --git a/src/f_op/f_op_msg.cpp b/src/f_op/f_op_msg.cpp index 36a80b7a0..1a2783dfa 100644 --- a/src/f_op/f_op_msg.cpp +++ b/src/f_op/f_op_msg.cpp @@ -10,17 +10,17 @@ #include "d/d_s_play.h" /* 8002A688-8002A6B0 .text fopMsg_Draw__FPv */ -static int fopMsg_Draw(void* i_this) { +int fopMsg_Draw(void* i_this) { msg_class* _this = static_cast(i_this); return fpcLf_DrawMethod(_this->mSubMtd, i_this); } /* 8002A6B0-8002A6E8 .text fopMsg_Execute__FPv */ -static int fopMsg_Execute(void* i_this) { +int fopMsg_Execute(void* i_this) { msg_class* _this = static_cast(i_this); int stat = 1; - if (dScnPly_ply_c::isPause()) { + if (!dScnPly_ply_c::isPause()) { stat = fpcMtd_Execute(&_this->mSubMtd->mBase, i_this); } @@ -28,7 +28,7 @@ static int fopMsg_Execute(void* i_this) { } /* 8002A6E8-8002A73C .text fopMsg_IsDelete__FPv */ -static int fopMsg_IsDelete(void* i_this) { +int fopMsg_IsDelete(void* i_this) { msg_class* _this = static_cast(i_this); int stat = fpcMtd_IsDelete(&_this->mSubMtd->mBase, i_this); @@ -40,7 +40,7 @@ static int fopMsg_IsDelete(void* i_this) { } /* 8002A73C-8002A788 .text fopMsg_Delete__FPv */ -static int fopMsg_Delete(void* i_this) { +int fopMsg_Delete(void* i_this) { msg_class* _this = static_cast(i_this); int stat = fpcMtd_Delete(&_this->mSubMtd->mBase, i_this);