From 6e83a87f421824ba3b69b232eba36061d69015ac Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sat, 1 Mar 2025 00:48:29 -0500 Subject: [PATCH] Implement dCom attention inlines --- include/d/d_attention.h | 21 +++++++----- include/d/d_com_inf_game.h | 60 ++++++++++++++++++++++++++------- src/d/actor/d_a_nh.cpp | 2 +- src/d/actor/d_a_npc_btsw2.cpp | 1 + src/d/actor/d_a_npc_ji1.cpp | 2 +- src/d/actor/d_a_npc_md.cpp | 2 +- src/d/actor/d_a_obj_mknjd.cpp | 6 ++-- src/d/actor/d_a_player.cpp | 2 +- src/d/actor/d_a_player_main.cpp | 2 +- src/d/actor/d_a_sail.cpp | 3 +- src/d/d_attention.cpp | 11 +++--- src/d/d_door.cpp | 1 + 12 files changed, 79 insertions(+), 34 deletions(-) diff --git a/include/d/d_attention.h b/include/d/d_attention.h index 0201a4aaa..bc1aab926 100644 --- a/include/d/d_attention.h +++ b/include/d/d_attention.h @@ -1,7 +1,6 @@ #ifndef D_D_ATTENTION_H #define D_D_ATTENTION_H -#include "SSystem/SComponent/c_angle.h" #include "m_Do/m_Do_ext.h" class fopAc_ac_c; @@ -171,15 +170,28 @@ public: void setFlag(u32 flag) { mFlags |= flag; } void clrFlag(u32 flag) { mFlags &= ~flag; } bool Lockon() { return LockonTruth() || chkFlag(0x20000000); } // regswap + void offAleart() { + setFlag(0x80000000); + } + void revivalAleart() { + clrFlag(0x80000000); + } + void CatchRequest(fopAc_ac_c* param_0, u8 param_1, f32 param_2, f32 param_3, f32 param_4, s16 param_5, int param_6) { mCatch.request(param_0, param_1, param_2, param_3, param_4, param_5, param_6); } + u8 getCatchChgItem() { return mCatch.getChangeItem(); } + fopAc_ac_c* getCatghTarget() { return mCatch.getCatghTarget(); } fopAc_ac_c* getLookTarget() { return mLook[0].convPId(mLook[0].getLookTarget()); } fopAc_ac_c* getLook2Target() { return mLook[1].convPId(mLook[1].getLookTarget()); } fopAc_ac_c* getZHintTarget() { return mHint.getZHintTarget(); } + int ZHintRequest(fopAc_ac_c* param_1, int param_2) { + return mHint.request(param_1, param_2); + } + static s32 loc_type_num; static u32 act_type_num; static struct LocTbl { @@ -201,15 +213,8 @@ public: void LockEdge() {} void changeOwner() {} void chkEnemySound() {} - u8 getCatchChgItem() { return mCatch.getChangeItem(); } - void getCatghTarget() {} - void offAleart() {} - void revivalAleart() { - clrFlag(0x80000000); - } void LookRequest(fopAc_ac_c*, f32, f32, f32, s16, int) {} void Look2RequestF(fopAc_ac_c*, s16, int) {} - void ZHintRequest(fopAc_ac_c*, int) {} public: /* 0x000 */ daPy_lk_c* mpPlayer; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index c58dfdae6..ead00fdfb 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -2135,14 +2135,6 @@ inline dVibration_c& dComIfGp_getVibration() { return g_dComIfG_gameInfo.play.getVibration(); } -inline dAttention_c& dComIfGp_getAttention() { - return g_dComIfG_gameInfo.play.getAttention(); -} - -inline void dComIfGp_att_revivalAleart() { - return dComIfGp_getAttention().revivalAleart(); -} - inline dDetect_c& dComIfGp_getDetect() { return g_dComIfG_gameInfo.play.getDetect(); } @@ -3494,14 +3486,58 @@ inline s32 dComIfGp_particle_checkAtrCodeEffect(int code) { return g_dComIfG_gam * === ATTENTION === */ + inline dAttention_c& dComIfGp_getAttention() { + return g_dComIfG_gameInfo.play.getAttention(); +} + +inline void dComIfGp_att_revivalAleart() { + dComIfGp_getAttention().revivalAleart(); +} + +inline void dComIfGp_att_offAleart() { + dComIfGp_getAttention().offAleart(); +} + +inline int dComIfGp_att_ZHintRequest(fopAc_ac_c* param_1, int param_2) { + return dComIfGp_getAttention().ZHintRequest(param_1, param_2); +} + +inline void dComIfGp_att_LookRequest(fopAc_ac_c* param_0, f32 i_horizontalDist, f32 i_upDist, + f32 i_downDist, s16 i_angle, int param_5) { + dComIfGp_getAttention().LookRequest(param_0, i_horizontalDist, i_upDist, i_downDist, i_angle, param_5); +} + +inline void dComIfGp_att_Look2RequestF(fopAc_ac_c* param_0, s16 param_1, int param_2) { + dComIfGp_getAttention().Look2RequestF(param_0, param_1, param_2); +} + inline void dComIfGp_att_CatchRequest(fopAc_ac_c* param_0, u8 param_1, f32 param_2, f32 param_3, - f32 param_4, s16 param_5, s32 param_6) { - dAttention_c& attention = g_dComIfG_gameInfo.play.getAttention(); - attention.CatchRequest(param_0, param_1, param_2, param_3, param_4,param_5, param_6); + f32 param_4, s16 param_5, int param_6) { + dComIfGp_getAttention().CatchRequest(param_0, param_1, param_2, param_3, param_4,param_5, param_6); } inline u8 dComIfGp_att_getCatchChgItem() { - return g_dComIfG_gameInfo.play.getAttention().getCatchChgItem(); + return dComIfGp_getAttention().getCatchChgItem(); +} + +inline fopAc_ac_c* dComIfGp_att_getCatghTarget() { + return dComIfGp_getAttention().getCatghTarget(); +} + +inline void dComIfGp_att_ChangeOwner() { + dComIfGp_getAttention().setFlag(0x80); +} + +inline fopAc_ac_c* dComIfGp_att_getLookTarget() { + return dComIfGp_getAttention().getLookTarget(); +} + +inline fopAc_ac_c* dComIfGp_att_getZHint() { + return dComIfGp_getAttention().getZHintTarget(); +} + +inline void dComIfGp_att_chkEnemySound() { + return dComIfGp_getAttention().chkEnemySound(); } /** diff --git a/src/d/actor/d_a_nh.cpp b/src/d/actor/d_a_nh.cpp index ff126cac6..43e865788 100644 --- a/src/d/actor/d_a_nh.cpp +++ b/src/d/actor/d_a_nh.cpp @@ -203,7 +203,7 @@ BOOL daNh_c::checkBinCatch() { return TRUE; } - dComIfGp_getAttention().CatchRequest( + dComIfGp_att_CatchRequest( this, dItem_FIREFLY_BOTTLE_e, l_HIO.prm.field_0x08, l_HIO.prm.field_0x0c, l_HIO.prm.field_0x10, l_HIO.prm.field_0x3c, diff --git a/src/d/actor/d_a_npc_btsw2.cpp b/src/d/actor/d_a_npc_btsw2.cpp index 178377c11..6331d2b4c 100644 --- a/src/d/actor/d_a_npc_btsw2.cpp +++ b/src/d/actor/d_a_npc_btsw2.cpp @@ -12,6 +12,7 @@ #include "f_op/f_op_actor_mng.h" #include "m_Do/m_Do_ext.h" #include "m_Do/m_Do_mtx.h" +#include "SSystem/SComponent/c_angle.h" #include "weak_bss_936_to_1036.h" // IWYU pragma: keep #include "weak_data_1811.h" // IWYU pragma: keep diff --git a/src/d/actor/d_a_npc_ji1.cpp b/src/d/actor/d_a_npc_ji1.cpp index 375c1fc8a..d0ba78bc1 100644 --- a/src/d/actor/d_a_npc_ji1.cpp +++ b/src/d/actor/d_a_npc_ji1.cpp @@ -3389,7 +3389,7 @@ BOOL daNpc_Ji1_c::CreateInit() { } } - dComIfGp_getAttention().setFlag(0x80000000); + dComIfGp_att_offAleart(); mEventCut.setActorInfo("Ji1", this); mEventCut.setJntCtrlPtr(&m_jnt); field_0xC84 = 0x12; diff --git a/src/d/actor/d_a_npc_md.cpp b/src/d/actor/d_a_npc_md.cpp index 19ca9aebd..ef55f4194 100644 --- a/src/d/actor/d_a_npc_md.cpp +++ b/src/d/actor/d_a_npc_md.cpp @@ -3170,7 +3170,7 @@ BOOL daNpc_Md_c::draw() { J3DModel* model = mpMorf->getModel(); J3DModelData* modelData = model->getModelData(); - g_env_light.settingTevStruct(0, ¤t.pos, &tevStr); + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &tevStr); drawDamageFog(); g_env_light.setLightTevColorType(model, &tevStr); m0520.entry(modelData); diff --git a/src/d/actor/d_a_obj_mknjd.cpp b/src/d/actor/d_a_obj_mknjd.cpp index 5d562f998..4dafaf537 100644 --- a/src/d/actor/d_a_obj_mknjd.cpp +++ b/src/d/actor/d_a_obj_mknjd.cpp @@ -316,7 +316,7 @@ s32 daObjMknjD::Act_c::Mthd_Create() { /* 00000B64-00000BDC .text Delete__Q210daObjMknjD5Act_cFv */ int daObjMknjD::Act_c::Delete() { - dComIfGp_getAttention().mFlags &= 0x7fffffff; + dComIfGp_att_revivalAleart(); for (int i = 0; i < 4; i++) { mSmokeCBs[i].end(); @@ -801,7 +801,7 @@ int daObjMknjD::Act_c::Execute(Mtx** i_mtx) { mDoAud_bgmStop(30); mDoAud_taktModeMuteOff(); - dComIfGp_getAttention().mFlags |= 0x80000000; + dComIfGp_att_offAleart(); if (m043E == true) { m0432 = 0x2B; @@ -818,7 +818,7 @@ int daObjMknjD::Act_c::Execute(Mtx** i_mtx) { privateCut(); if (dComIfGp_evmng_endCheck(mDemoEventIdx)) { - dComIfGp_getAttention().mFlags &= ~0x80000000; + dComIfGp_att_revivalAleart(); dComIfGp_event_reset(); fopAcM_delete(this); diff --git a/src/d/actor/d_a_player.cpp b/src/d/actor/d_a_player.cpp index 7d1916e5f..3ca1d9c0c 100644 --- a/src/d/actor/d_a_player.cpp +++ b/src/d/actor/d_a_player.cpp @@ -19,7 +19,7 @@ void daPy_py_c::changePlayer(fopAc_ac_c* newPlayer) { } dComIfGp_setPlayer(0, newPlayer); dComIfGp_getCamera(0)->mCamera.mpPlayerActor = newPlayer; - dComIfGp_getAttention().mFlags |= 0x80; + dComIfGp_att_ChangeOwner(); } /* 80102940-80102B84 .text objWindHitCheck__9daPy_py_cFP8dCcD_Cyl */ diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 499f6da24..e794465fc 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -3383,7 +3383,7 @@ BOOL daPy_lk_c::execute() { setActorPointer(); setAtnList(); - fopAc_ac_c* zTarget = dComIfGp_getAttention().getZHintTarget(); + fopAc_ac_c* zTarget = dComIfGp_att_getZHint(); if (zTarget) { stopDoButtonQuake(FALSE); } else { diff --git a/src/d/actor/d_a_sail.cpp b/src/d/actor/d_a_sail.cpp index 97e7ddf1b..a75952032 100644 --- a/src/d/actor/d_a_sail.cpp +++ b/src/d/actor/d_a_sail.cpp @@ -13,6 +13,7 @@ #include "f_op/f_op_actor_mng.h" #include "m_Do/m_Do_mtx.h" #include "SSystem/SComponent/c_lib.h" +#include "SSystem/SComponent/c_angle.h" #include "weak_bss_936_to_1036.h" // IWYU pragma: keep #include "weak_data_1811.h" // IWYU pragma: keep @@ -478,7 +479,7 @@ static BOOL daSail_Draw(sail_class* i_this) { i_this->tevStr = l_p_ship->tevStr; - g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->tevStr); + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->tevStr); g_env_light.setLightTevColorType(i_this->mSailPacket.mStickModel, &i_this->tevStr); mDoExt_modelUpdateDL(i_this->mSailPacket.mStickModel); diff --git a/src/d/d_attention.cpp b/src/d/d_attention.cpp index 06ad78105..fcd465b1d 100644 --- a/src/d/d_attention.cpp +++ b/src/d/d_attention.cpp @@ -11,6 +11,7 @@ #include "d/d_s_play.h" #include "m_Do/m_Do_ext.h" #include "JSystem/JKernel/JKRSolidHeap.h" +#include "SSystem/SComponent/c_angle.h" s32 dAttention_c::loc_type_num = 3; u32 dAttention_c::act_type_num = 5; @@ -378,12 +379,12 @@ void dAttention_c::stockAttention(u32 interactMask) { if (pTarget != mLockOnList[0].getActor()) { if (pTarget != NULL) { if (mLockOnList[0].getActor() != NULL) - mFlags |= 2; + setFlag(0x02); } else { - mFlags |= 1; + setFlag(0x01); } - mFlags |= 4; + setFlag(0x04); } LockonTarget(0); @@ -452,12 +453,12 @@ BOOL sound_attention(fopAc_ac_c* actor, void* userWork) { void dAttention_c::runSoundProc() { mEnemyBsPcId = fpcM_ERROR_PROCESS_ID_e; mEnemyDistance = 10000.0f; - if (!(mFlags & 0x80000000)) { + if (!chkFlag(0x80000000)) { fopAcIt_Executor((fopAcIt_ExecutorFunc)sound_attention, this); fopAc_ac_c* actor = fopAcM_SearchByID(mEnemyBsPcId); if (actor != NULL) { mDoAud_bgmNowBattle(mEnemyDistance * 0.1f); - mFlags |= 0x100; + setFlag(0x100); } } } diff --git a/src/d/d_door.cpp b/src/d/d_door.cpp index 97e0d248d..8ab882a87 100644 --- a/src/d/d_door.cpp +++ b/src/d/d_door.cpp @@ -9,6 +9,7 @@ #include "d/res/res_key.h" #include "d/res/res_hkyo.h" #include "d/actor/d_a_player.h" +#include "SSystem/SComponent/c_angle.h" /* 8006B39C-8006B3A8 .text getSwbit__12dDoor_info_cFv */ u8 dDoor_info_c::getSwbit() {