From e652f902b7083e7f060aafcbebf271aac7c76610 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Wed, 23 Sep 2026 16:19:00 -0400 Subject: [PATCH] d_a_player_main inlines and fix himo2/himo3 confusion --- .../JSystem/J3DGraphAnimator/J3DAnimation.h | 18 +-- .../JSystem/J3DGraphAnimator/J3DMaterialAnm.h | 2 +- include/SSystem/SComponent/c_cc_d.h | 7 +- include/d/actor/d_a_himo3.h | 2 +- include/d/actor/d_a_player_main.h | 4 +- include/d/actor/d_a_salvage.h | 9 +- include/d/d_gameover.h | 26 ++++ src/SSystem/SComponent/c_cc_s.cpp | 10 +- src/d/actor/d_a_himo3.cpp | 2 +- src/d/actor/d_a_player_bottle.inc | 4 +- src/d/actor/d_a_player_dproc.inc | 45 +++---- src/d/actor/d_a_player_main.cpp | 31 +++-- src/d/actor/d_a_player_particle.inc | 3 +- src/d/actor/d_a_player_rope.inc | 119 +++++++++--------- src/d/actor/d_a_player_ship.inc | 17 +-- src/d/actor/d_a_player_tact.inc | 8 +- src/d/d_cc_s.cpp | 2 +- 17 files changed, 155 insertions(+), 154 deletions(-) diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index 2a72dd72b..57a293cbb 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -307,6 +307,10 @@ struct J3DAnmClusterKeyData { class J3DAnmBase { public: + J3DAnmBase() { + mFrame = 0.0f; + mFrameMax = 0; + } J3DAnmBase(s16 i_frameMax) { mFrame = 0.0f; mFrameMax = i_frameMax; @@ -395,7 +399,7 @@ class J3DAnmTextureSRTKey : public J3DAnmBase { public: friend class J3DAnmKeyLoader_v15; - J3DAnmTextureSRTKey() : J3DAnmBase(0) { + J3DAnmTextureSRTKey() { mDecShift = 0; mTransNum = 0; mRotNum = 0; @@ -484,7 +488,7 @@ class J3DAnmVisibilityFull : public J3DAnmBase { public: friend class J3DAnmFullLoader_v15; - J3DAnmVisibilityFull() : J3DAnmBase(0) { + J3DAnmVisibilityFull() { mUpdateMaterialNum = 0; mAnmTable = NULL; field_0x12 = 0; @@ -509,7 +513,7 @@ class J3DAnmTexPattern : public J3DAnmBase { public: friend class J3DAnmFullLoader_v15; - J3DAnmTexPattern() : J3DAnmBase(0) { + J3DAnmTexPattern() { mTextureIndex = NULL; mAnmTable = NULL; mKind = 2; @@ -545,7 +549,7 @@ class J3DAnmTevRegKey : public J3DAnmBase { public: friend class J3DAnmKeyLoader_v15; - J3DAnmTevRegKey() : J3DAnmBase(0) { + J3DAnmTevRegKey() { mKRegUpdateMaterialNum = 0; mCRegUpdateMaterialNum = 0; mCRegDataCountA = 0; @@ -623,7 +627,7 @@ private: // BPK class J3DAnmColor : public J3DAnmBase { public: - J3DAnmColor() : J3DAnmBase(0) { + J3DAnmColor() { field_0x16 = 0; field_0x14 = 0; field_0x12 = 0; @@ -712,7 +716,7 @@ public: class J3DAnmVtxColor : public J3DAnmBase { public: - J3DAnmVtxColor() : J3DAnmBase(0) { + J3DAnmVtxColor() { mKind = 7; for (int i = 0; i < 2; i++) { mAnmTableNum[i] = 0; @@ -778,7 +782,7 @@ protected: class J3DAnmCluster : public J3DAnmBase { public: - J3DAnmCluster(s16 param_1, f32* param_2) : J3DAnmBase(0) { + J3DAnmCluster(s16 param_1, f32* param_2) { mWeight = param_2; mKind = param_1; } diff --git a/include/JSystem/J3DGraphAnimator/J3DMaterialAnm.h b/include/JSystem/J3DGraphAnimator/J3DMaterialAnm.h index 14fd86602..ff1e89583 100644 --- a/include/JSystem/J3DGraphAnimator/J3DMaterialAnm.h +++ b/include/JSystem/J3DGraphAnimator/J3DMaterialAnm.h @@ -169,7 +169,7 @@ public: const J3DTexMtxAnm* getTexMtxAnm(int i) const { return mTexMtxAnm[i]; } -private: +protected: /* 0x04 */ J3DMatColorAnm* mMatColorAnm[2]; /* 0x0C */ J3DTexMtxAnm* mTexMtxAnm[8]; /* 0x2C */ J3DTexNoAnm* mTexNoAnm[8]; diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index 97aaa75b1..49ac7eb95 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -91,7 +91,6 @@ public: virtual bool GetNVec(cXyz const&, cXyz*) const = 0; cM3dGAab& GetWorkAab() { return mAab; } - cM3dGAab const& GetWorkAab() const { return mAab; } static cXyz m_virtual_center; }; // Size: 0x20 @@ -354,12 +353,13 @@ public: m_cc_move.x = m_cc_move.y = m_cc_move.z = 0.0f; } void PlusDmg(int dmg) { m_dmg = dmg; } - u8 GetDmg() { return m_dmg; } + u8 GetDmg() const { return m_dmg; } f32 GetWeightF() const { return (s32)m_weight; } u8 GetWeightUc() const { return m_weight; } void SetWeight(u8 weight) { m_weight = weight; } virtual void ClrAt() {} virtual void ClrTg() { m_dmg = 0; } + void ClrCo() { ClrCcMove(); } fopAc_ac_c* GetActor() const { return mp_actor; } void SetActor(void* ac) { mp_actor = (fopAc_ac_c*)ac; } @@ -602,9 +602,8 @@ public: cCcD_Stts* GetStts() { return mStts; } void SetStts(cCcD_Stts* stts) { mStts = stts; } fopAc_ac_c* GetAc() { return mStts == NULL ? NULL : mStts->GetActor(); } - cCcD_DivideInfo& GetDivideInfo() { return mDivideInfo; } cCcD_DivideInfo* GetPDivideInfo() { return &mDivideInfo; } - u32 ChkBsRevHit() const { return mFlags & 2; } + u32 ChkBsRevHit() { return mFlags & 2; } void OnBsRevHit() { mFlags |= 2; } private: diff --git a/include/d/actor/d_a_himo3.h b/include/d/actor/d_a_himo3.h index ba22885e8..997d74e09 100644 --- a/include/d/actor/d_a_himo3.h +++ b/include/d/actor/d_a_himo3.h @@ -27,7 +27,7 @@ struct h3_ga_s { class himo3_class { public: - void getPlayerMoveLength() {} + f32 getPlayerMoveLength() { return m15FC; } void setActorHang(cXyz, short); diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 58fb19888..8b16c80fa 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -74,8 +74,6 @@ private: class daPy_actorKeep_c { public: - daPy_actorKeep_c() {} - void setActor(); void setData(fopAc_ac_c*); void clearData(); @@ -2296,7 +2294,7 @@ private: /* 0x361C */ u32 mMtrlSndId; /* 0x3620 */ u32 m3620; /* 0x3624 */ u32 m3624; - /* 0x3628 */ fpc_ProcID m3628; + /* 0x3628 */ fpc_ProcID mGameOverId; /* 0x362C */ fpc_ProcID mTactZevPartnerId; /* 0x3630 */ fpc_ProcID m3630; /* 0x3634 */ fpc_ProcID mWhirlId; diff --git a/include/d/actor/d_a_salvage.h b/include/d/actor/d_a_salvage.h index ff9f6fd4f..87befa125 100644 --- a/include/d/actor/d_a_salvage.h +++ b/include/d/actor/d_a_salvage.h @@ -12,14 +12,19 @@ class daSalvage_c : public fopAc_ac_c { public: static int getSalvageId() { return mSalvageId; } - void setSalvageId(int salvageId) { mSalvageId = salvageId; } + static void setSalvageId(int salvageId) { mSalvageId = salvageId; } static BOOL isValidSalvageId() { if (mSalvageId != -1) { return TRUE; } return FALSE; } - void getSalvageKind() {} + static int getSalvageKind() { + if (isValidSalvageId()) { + return mTagData_p->getType(getSalvageId()); + } + return -1; + } BOOL checkRegist(int arg1) { return mTagData_p->checkRegist(arg1); } BOOL checkUsed(int arg1) { return mTagData_p->checkUsed(arg1); } diff --git a/include/d/d_gameover.h b/include/d/d_gameover.h index dc037db81..a2c87090a 100644 --- a/include/d/d_gameover.h +++ b/include/d/d_gameover.h @@ -97,4 +97,30 @@ private: /* 0x11C */ u8 field_0x11c; }; +inline fpc_ProcID d_GameOver_Create() { + return fopMsgM_create(fpcNm_GAMEOVER_e);; +} + +inline void d_GameOver_setBackAlpha(fpc_ProcID& pid, f32 alpha) { + dGameover_c* gameover = (dGameover_c*)fopMsgM_SearchByID(pid); + if (gameover) { + gameover->setBackAlpha(alpha); + } +} + +inline void d_GameOver_animeStart(fpc_ProcID& pid) { + dGameover_c* gameover = (dGameover_c*)fopMsgM_SearchByID(pid); + if (gameover) { + gameover->animeStart(); + } +} + +inline BOOL d_GameOver_CheckDelete(fpc_ProcID& pid) { + dGameover_c* gameover = (dGameover_c*)fopMsgM_SearchByID(pid); + if (gameover != NULL) { + return gameover->deleteCheck(); + } + return FALSE; +} + #endif /* D_GAMEOVER_H */ diff --git a/src/SSystem/SComponent/c_cc_s.cpp b/src/SSystem/SComponent/c_cc_s.cpp index 12187cd4b..ec0db7bed 100644 --- a/src/SSystem/SComponent/c_cc_s.cpp +++ b/src/SSystem/SComponent/c_cc_s.cpp @@ -66,7 +66,7 @@ void cCcS::ClrCoHitInf() { pInf->ClrCoHit(); cCcD_Stts * pStts = mpObjCo[i]->GetStts(); if (pStts != NULL) - pStts->ClrCcMove(); + pStts->ClrCo(); } } } @@ -125,7 +125,7 @@ void cCcS::ChkAtTg() { for (cCcD_Obj** pObjTg = mpObjTg; pObjTg < objTgEnd; ++pObjTg) { if (*pObjTg == NULL || !(*pObjTg)->ChkTgSet()) continue; - if (!(*pObjAt)->GetDivideInfo().Chk((*pObjTg)->GetDivideInfo())) + if (!(*pObjAt)->GetPDivideInfo()->Chk(*(*pObjTg)->GetPDivideInfo())) continue; if (ChkNoHitAtTg(*pObjAt, *pObjTg)) continue; @@ -180,7 +180,7 @@ void cCcS::ChkCo() { for (cCcD_Obj** objCo2 = objCo1 + 1; objCo2 < objCoEnd; ++objCo2) { if (*objCo2 == NULL || !(*objCo2)->ChkCoSet()) continue; - if (!(*objCo1)->GetDivideInfo().Chk((*objCo2)->GetDivideInfo())) + if (!(*objCo1)->GetPDivideInfo()->Chk(*(*objCo2)->GetPDivideInfo())) continue; if (ChkNoHitCo(*objCo1, *objCo2)) continue; @@ -421,10 +421,10 @@ void cCcS::CalcArea() { mDivideArea.SetArea(aab); for (cCcD_Obj** pObj = mpObj; pObj < mpObj + mObjCount; ++pObj) { if (*pObj != NULL) { - const cCcD_ShapeAttr* objShape = (*pObj)->GetShapeAttr(); + cCcD_ShapeAttr* objShape = (*pObj)->GetShapeAttr(); if (objShape == NULL) continue; - cCcD_DivideInfo* divideInfo = &(*pObj)->GetDivideInfo(); + cCcD_DivideInfo* divideInfo = (*pObj)->GetPDivideInfo(); mDivideArea.CalcDivideInfo(divideInfo, objShape->GetWorkAab(), (*pObj)->ChkBsRevHit()); } } diff --git a/src/d/actor/d_a_himo3.cpp b/src/d/actor/d_a_himo3.cpp index 1dd324251..31e362c53 100644 --- a/src/d/actor/d_a_himo3.cpp +++ b/src/d/actor/d_a_himo3.cpp @@ -1,6 +1,6 @@ /** * d_a_himo3.cpp - * Object - Rope (Pirate Ship rope minigame, Forsaken Fortress) + * Object - Climbable Rope (Pirate Ship rope minigame, Forsaken Fortress, Puppet Ganon's room) */ #include "d/dolzel_rel.h" // IWYU pragma: keep diff --git a/src/d/actor/d_a_player_bottle.inc b/src/d/actor/d_a_player_bottle.inc index af7007f8d..cf3889414 100644 --- a/src/d/actor/d_a_player_bottle.inc +++ b/src/d/actor/d_a_player_bottle.inc @@ -480,7 +480,7 @@ BOOL daPy_lk_c::procBottleSwing() { if (!strcmp(dComIfGp_getStartStageName(), "Omori")) { bVar5 = dItemNo_FOREST_WATER_e; if (dComIfGs_checkBottle(dItemNo_FOREST_WATER_e)) { - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; mProcVar7.m3574 = 1; } else { dComIfGs_getpItemRecord()->resetTimer(36000); @@ -545,7 +545,7 @@ BOOL daPy_lk_c::procBottleGet_init() { m_HIO->mItem.mBottle.m.field_0x38 ); dComIfGp_setPlayerStatus1(0, daPyStts1_UNK1000_e); - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; mProcVar6.m3570 = 0; dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", &mProcVar6.m3570, 0); if (mEquipItem == dItemNo_FOREST_WATER_e) { diff --git a/src/d/actor/d_a_player_dproc.inc b/src/d/actor/d_a_player_dproc.inc index 4eedbb83e..4f1e6e968 100644 --- a/src/d/actor/d_a_player_dproc.inc +++ b/src/d/actor/d_a_player_dproc.inc @@ -107,10 +107,10 @@ void daPy_lk_c::setShapeAngleToTalkActor() { /* 8012D08C-8012D134 .text checkEndMessage__9daPy_lk_cFUl */ BOOL daPy_lk_c::checkEndMessage(u32 i_msgNo) { - if (m3628 == fpcM_ERROR_PROCESS_ID_e) { - m3628 = fopMsgM_messageSet(i_msgNo); + if (mGameOverId == fpcM_ERROR_PROCESS_ID_e) { + mGameOverId = fopMsgM_messageSet(i_msgNo); } else { - msg_class* msg_p = fopMsgM_SearchByID(m3628); + msg_class* msg_p = fopMsgM_SearchByID(mGameOverId); if (msg_p != NULL) { if (msg_p->mStatus == fopMsgStts_MSG_DISPLAYED_e) { msg_p->mStatus = fopMsgStts_MSG_ENDS_e; @@ -703,7 +703,7 @@ BOOL daPy_lk_c::dProcGetItem_init() { camera_process_class* cam = dComIfGp_getCamera(mCameraInfoIdx); mProcVar3.m34D6 = shape_angle.y - fopCamM_GetAngleY(cam); current.angle.y = shape_angle.y; - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; mProcVar0.m34D0 = 0; mProcVar4.m34D8 = sVar6; initShipRideUseItem(iVar2, 0); @@ -950,7 +950,7 @@ BOOL daPy_lk_c::dProcFreezeDamage() { void daPy_lk_c::dProcDead_init_sub() { mProcVar6.m3570 = 0; dComIfGp_setPlayerStatus0(0, daPyStts0_UNK20000000_e); - m3628 = fopMsgM_create(fpcNm_GAMEOVER_e); + mGameOverId = d_GameOver_Create(); mDemo.setSpecialDemoType(); daPy_py_c::changePlayer(this); } @@ -1072,32 +1072,21 @@ BOOL daPy_lk_c::dProcDead() { } if (frameCtrl.getRate() < 0.01f) { cLib_chaseF(&m35A0, 0.0f, 0.01f); - f32 dVar3 = 1.0f - m35A0; - if (m3628 != fpcM_ERROR_PROCESS_ID_e) { - dGameover_c* gameover = (dGameover_c*)fopMsgM_SearchByID(m3628); - if (gameover) { - gameover->setBackAlpha(dVar3); - } + f32 alpha = 1.0f - m35A0; + if (mGameOverId != fpcM_ERROR_PROCESS_ID_e) { + d_GameOver_setBackAlpha(mGameOverId, alpha); } - if (m35A0 < 0.38f && m3628 != fpcM_ERROR_PROCESS_ID_e) { - dGameover_c* gameover = (dGameover_c*)fopMsgM_SearchByID(m3628); - if (gameover) { - gameover->animeStart(); - } + if (m35A0 < 0.38f && mGameOverId != fpcM_ERROR_PROCESS_ID_e) { + d_GameOver_animeStart(mGameOverId); } if (mProcVar7.m3574 == 0) { - int iVar1; - if (m3628 != fpcM_ERROR_PROCESS_ID_e) { - dGameover_c* gameover = (dGameover_c*)fopMsgM_SearchByID(m3628); - if (gameover != NULL) { - iVar1 = gameover->deleteCheck(); - } else { - iVar1 = 0; - } + BOOL iVar1; + if (mGameOverId != fpcM_ERROR_PROCESS_ID_e) { + iVar1 = d_GameOver_CheckDelete(mGameOverId); } else { - iVar1 = 0; + iVar1 = FALSE; } - if (iVar1 != 0) { + if (iVar1) { mProcVar7.m3574 = 1; } } @@ -2086,7 +2075,7 @@ BOOL daPy_lk_c::dProcGetDance_init() { camera_process_class* cam = dComIfGp_getCamera(mCameraInfoIdx); mProcVar3.m34D6 = shape_angle.y - fopCamM_GetAngleY(cam); current.angle.y = shape_angle.y; - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; mProcVar0.m34D0 = 0; mProcVar6.m3570 = mDemo.getParam0() + 0xd2; dComIfGs_onTact(mDemo.getParam0()); @@ -2319,7 +2308,7 @@ BOOL daPy_lk_c::dProcPowerUp_init() { } } mProcVar7.m3574 = 0; - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; initShipRideUseItem(iVar2, 2); if (dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e)) { shape_angle.y -= -0x8000; diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 7dfc3173c..5ef8752a1 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -134,9 +134,9 @@ void daPy_matAnm_c::calc(J3DMaterial* mat) const { J3DMaterialAnm::calc(mat); for (u32 i = 0; i < 8; i++) { - if (getTexMtxAnm(i)) { + if (mTexMtxAnm[i]) { J3DTextureSRTInfo& srt = mat->getTexMtx(i)->getTexMtxInfo().mSRT; - if (getMorfFrame() != 0) { + if (m_morf_frame != 0) { f32 temp = 1.0f / (m_morf_frame + 1); srt.mTranslationX = mOldOffset.x * (1.0f - temp) + (srt.mTranslationX * temp); srt.mTranslationY = mOldOffset.y * (1.0f - temp) + (srt.mTranslationY * temp); @@ -704,7 +704,7 @@ u16 daPy_lk_c::checkNormalFace() { if (checkNoResetFlg1(daPyFlg1_CONFUSE)) { return daPyFace_TMABAH_TABEKOBE; } - if (checkNoResetFlg0(daPyFlg0_HEAVY_STATE)) { + if (getHeavyState()) { return daPyFace_TMABAH; } if (checkNoResetFlg1(daPyFlg1_UNK1000000) && !checkModeFlg(ModeFlg_00000001)) { @@ -1165,7 +1165,7 @@ s32 daPy_lk_c::setItemModel() { if (mpBottleContentsModel != NULL) { if (mEquipItem == dItemNo_FIREFLY_BOTTLE_e) { cXyz scale; - f32 fVar1 = 1.0f + 0.1f * cM_ssin(cM_rad2s((37.699112f * mpEquipItemBrk->getFrame()) / mpEquipItemBrk->getFrameMax())); + f32 fVar1 = 1.0f + 0.1f * cM_fsin((37.699112f * mpEquipItemBrk->getFrame()) / mpEquipItemBrk->getFrameMax()); scale.setall(fVar1); mDoMtx_stack_c::transS(11.0f, 0.0f, 0.0f); mDoMtx_stack_c::revConcat(lHandA_jnt_mtx); @@ -2424,7 +2424,7 @@ void daPy_lk_c::posMoveFromFootPos() { f32 f1 = ( (speedF * (1.0f - m_HIO->mSwim.m.field_0x60)) + m_HIO->mSwim.m.field_0x60 * - (speedF * std::abs(cM_scos(cM_rad2s(M_PI * (mFrameCtrlUnder[UNDER_MOVE0_e].getFrame() / mFrameCtrlUnder[UNDER_MOVE0_e].getEnd()))))) + (speedF * std::abs(cM_fcos(M_PI * (mFrameCtrlUnder[UNDER_MOVE0_e].getFrame() / mFrameCtrlUnder[UNDER_MOVE0_e].getEnd())))) ) / (1.0f + (m_HIO->mSwim.m.field_0x7C * getSwimTimerRate())); speed.x = f1 * cM_ssin(current.angle.y); speed.z = f1 * cM_scos(current.angle.y); @@ -8513,7 +8513,7 @@ BOOL daPy_lk_c::procNotUse_init(int param_1) { setSingleMoveAnime(ANM_PRESENTATIONB, m_HIO->mTurn.m.field_0x34, m_HIO->mTurn.m.field_0x38, m_HIO->mTurn.m.field_0x10, m_HIO->mTurn.m.field_0x3C); keepItemData(); dComIfGp_setPlayerStatus1(0, daPyStts1_UNK800_e); - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; mProcVar6.m3570 = param_1; mProcVar7.m3574 = 5; dCam_getBody()->StartEventCamera(0x12, fopAcM_GetID(this), "Type", &mProcVar7.m3574, 0); @@ -8549,10 +8549,10 @@ BOOL daPy_lk_c::procNotUse() { setBottleModel(mProcVar6.mBottleItem); mProcVar2.m34D4 = 1; } - if (m3628 == fpcM_ERROR_PROCESS_ID_e) { - m3628 = fopMsgM_messageSet(m3624); + if (mGameOverId == fpcM_ERROR_PROCESS_ID_e) { + mGameOverId = fopMsgM_messageSet(m3624); } else { - msg_class* msg_p = fopMsgM_SearchByID(m3628); + msg_class* msg_p = fopMsgM_SearchByID(mGameOverId); if (msg_p != 0) { if (msg_p->mStatus == fopMsgStts_MSG_DISPLAYED_e) { if (m3624 == 0xf0c && msg_p->mSelectNum == 1) { @@ -11198,7 +11198,7 @@ BOOL daPy_lk_c::execute() { onNoResetFlg1(daPyFlg1_UNK200); dComIfGs_setBottleItemIn(dItemNo_FOREST_WATER_e, dItemNo_WATER_BOTTLE_e); mDemo.setSpecialDemoType(); - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; #if VERSION > VERSION_JPN if (mCurProc == daPyProc_SCOPE_e) { procWait_init(); @@ -11240,12 +11240,9 @@ BOOL daPy_lk_c::execute() { if (dComIfGp_event_runCheck()) { mStaffIdx = dComIfGp_evmng_getMyStaffId("Link", this); if (eventInfo.checkCommandDoor() && !dComIfGp_event_chkEventFlag(0x4) && mEquipItem == daPyItem_BOKO_e) { - fopAc_ac_c* equip_actor = mActorKeepEquip.getActor(); - if (equip_actor) { - s16 angle = shape_angle.y + 0x8000; - equip_actor->speed.y = 0.0f; - equip_actor->speedF = 5.0f; - equip_actor->current.angle.y = angle; + daBoko_c* boko = (daBoko_c*)mActorKeepEquip.getActor(); + if (boko) { + boko->moveStateInit(5.0f, 0.0f, shape_angle.y + 0x8000); } deleteEquipItem(FALSE); } @@ -12273,7 +12270,7 @@ void daPy_lk_c::playerInit() { mActorKeepThrow.clearData(); mActorKeepGrab.clearData(); mActorKeepRope.clearData(); - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; mWhirlId = fpcM_ERROR_PROCESS_ID_e; mTactZevPartnerId = fpcM_ERROR_PROCESS_ID_e; m3630 = fpcM_ERROR_PROCESS_ID_e; diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 739ef9975..c94d7218f 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -642,12 +642,11 @@ void daPy_lk_c::setWaterRipple() { ) ) ) { - if (m3280.getEmitter() == NULL) { dComIfGp_particle_setShipTail(dPa_name::ID_AK_JN_HAMON00, ¤t.pos, NULL, NULL, 0xFF, &m3280); } - f32 var_f1 = (0.1f * std::fabsf(getSpeedF())); + f32 var_f1 = (0.1f * std::fabsf(speedF)); var_f1 *= var_f1; if (var_f1 > 1.0f) { var_f1 = 1.0f; diff --git a/src/d/actor/d_a_player_rope.inc b/src/d/actor/d_a_player_rope.inc index ab480086e..919f1a445 100644 --- a/src/d/actor/d_a_player_rope.inc +++ b/src/d/actor/d_a_player_rope.inc @@ -14,13 +14,14 @@ #include "d/actor/d_a_player_main.h" #include "d/actor/d_a_player_HIO.h" #include "d/actor/d_a_himo2.h" +#include "d/actor/d_a_himo3.h" #include "d/d_attention.h" #include "f_op/f_op_actor_mng.h" #include "m_Do/m_Do_audio.h" /* 80142D08-80142D68 .text checkRopeAnime__9daPy_lk_cCFv */ BOOL daPy_lk_c::checkRopeAnime() const { - return (checkRopeReadyAnime()) || (checkUpperAnime(dRes_INDEX_LKANM_BCK_ROPETHROW_e)); + return checkRopeReadyAnime() || checkUpperAnime(dRes_INDEX_LKANM_BCK_ROPETHROW_e); } /* 80142D68-80142E0C .text freeRopeItem__9daPy_lk_cFv */ @@ -56,11 +57,11 @@ f32 daPy_lk_c::checkRopeRoofHit(s16 param_0) { /* 80142E98-80142FC8 .text changeRopeSwingProc__9daPy_lk_cFv */ int daPy_lk_c::changeRopeSwingProc() { if (mCyl.ChkCoHit() != 0) { - fopAc_ac_c* pfVar2 = mCyl.GetCoHitAc(); - if ((pfVar2 != NULL) && (fopAcM_GetName(pfVar2) == fpcNm_HIMO3_e)) { - cXyz local_24 = pfVar2->current.pos - current.pos; - if ((local_24.abs() - 95.0f >= 100.0f) && (pfVar2->current.pos.y > current.pos.y)) { - return procRopeSwing_init(pfVar2, 0x1800); + fopAc_ac_c* hit_actor = mCyl.GetCoHitAc(); + if (hit_actor != NULL && fopAcM_GetName(hit_actor) == fpcNm_HIMO3_e) { + cXyz local_24 = hit_actor->current.pos - current.pos; + if (local_24.abs() - 95.0f >= 100.0f && hit_actor->current.pos.y > current.pos.y) { + return procRopeSwing_init(hit_actor, 0x1800); } } } @@ -73,7 +74,7 @@ int daPy_lk_c::changeRopeEndProc(int param_0) { if (doTrigger() || cancelTrigger() || (!checkRopeTag() && itemTrigger())) { freeRopeItem(); voiceStart(6); - if ((cancelTrigger()) && (!checkBossGomaStage())) { + if (cancelTrigger() && !checkBossGomaStage()) { setAnimeEquipSword(0); } if (param_0 != 0) { @@ -200,10 +201,10 @@ void daPy_lk_c::setBlendRopeMoveAnime(int param_0) { } dVar6 = 1.0f; cLib_chaseF(&sp08, dVar6, 0.05f); - if (((mProcVar0.m34D0 == -1) && (M_PI / 2 < f30)) || (mProcVar0.m34D0 == 1 && (-M_PI / 2 < f30))) { + if ((mProcVar0.m34D0 == -1 && M_PI / 2 < f30) || (mProcVar0.m34D0 == 1 && -M_PI / 2 < f30)) { mProcVar0.m34D0 = 0; } - } else if (((param_0 != 0) || (mStickDistance <= 0.05f)) || (spActionButton())) { + } else if (param_0 != 0 || mStickDistance <= 0.05f || spActionButton()) { if (f2 <= M_PI / 2) { anm = ANM_ROPESWINGB; } else { @@ -217,12 +218,12 @@ void daPy_lk_c::setBlendRopeMoveAnime(int param_0) { dVar6 = 0.6f; } } else { - if ((M_PI / 2 > f30) && (M_PI / 10 <= f30)) { + if (M_PI / 2 > f30 && M_PI / 10 <= f30) { setMoveAnime(0.0f, m_HIO->mItem.mRope.m.field_0x18, 1.0f, ANM_ROPECATCH, ANM_ROPESWINGF, 7, 7.0f); mProcVar0.m34D0 = -1; return; } - if ((-M_PI / 2 > f30) && (-2.8274333f <= f30)) { + if (-M_PI / 2 > f30 && -2.8274333f <= f30) { setMoveAnime(0.0f, m_HIO->mItem.mRope.m.field_0x18, 1.0f, ANM_ROPECATCH, ANM_ROPESWINGB, 7, 7.0f); mProcVar0.m34D0 = 1; return; @@ -333,20 +334,18 @@ BOOL daPy_lk_c::checkNextActionRopeReady() { } else if (!checkAttentionLock()) { dComIfGp_setDoStatus(dActStts_RETURN_e); } - if (((itemButton()) && (mEquipItem == getReadyItem())) && (m355C == 0)) { + if (itemButton() && mEquipItem == getReadyItem() && m355C == 0) { m355E = 1; - } else { - if ((!itemButton()) && (m355E != 0)) { - m355E = 0; - if (throwRope()) { - return true; - } + } else if (!itemButton() && m355E != 0) { + m355E = 0; + if (throwRope()) { + return true; } } if (cancelItemUpperReadyAnime()) { return true; } - } else if (((rope->m02DC == 5) || (rope->m02DC == 8)) || (rope->m02DC == 9)) { + } else if (rope->m02DC == 5 || rope->m02DC == 8 || rope->m02DC == 9) { return procRopeThrowCatch_init(); } else { checkNextRopeMode(); @@ -360,7 +359,7 @@ BOOL daPy_lk_c::checkNextActionRopeReady() { /* 80143DF4-80143EAC .text checkNextRopeMode__9daPy_lk_cFv */ BOOL daPy_lk_c::checkNextRopeMode() { - if ((!checkRopeReadyAnime()) && (!fopAcM_GetParam(mActorKeepEquip.getActor()))) { + if (!checkRopeReadyAnime() && !fopAcM_GetParam(mActorKeepEquip.getActor())) { m355C = 10; m355E = 0; seStartOnlyReverb(JA_SE_LK_ITEM_TAKEOUT); @@ -421,8 +420,8 @@ BOOL daPy_lk_c::procRopeSubject() { return true; } - himo2_class* grapple = (himo2_class*)mActorKeepEquip.getActor(); - if (fopAcM_GetParam(grapple) == 0) { + himo2_class* rope = (himo2_class*)mActorKeepEquip.getActor(); + if (fopAcM_GetParam(rope) == 0) { dComIfGp_clearPlayerStatus0(0, daPyStts0_UNK40000_e); } else { dComIfGp_setPlayerStatus0(0, daPyStts0_UNK40000_e); @@ -442,7 +441,7 @@ BOOL daPy_lk_c::procRopeSubject() { mSightPacket.onDrawFlg(); mSightPacket.setPos(&sight); - if (grapple->setTargetPos(&sight, &m3600, &m3604)) { + if (rope->setTargetPos(&sight, &m3600, &m3604)) { mSightPacket.onDrawFlg(); if (mSightPacket.getLockFlg()) { mSightPacket.incFrame(); @@ -480,7 +479,7 @@ BOOL daPy_lk_c::procRopeReady_init() { if (m3600 >= 0.0f) { m370C.y = rope->current.pos.y - m3600; } else { - if ((checkBossGomaStage()) && (rope->current.pos.y - current.pos.y > 700.0f)) { + if (checkBossGomaStage() && rope->current.pos.y - current.pos.y > 700.0f) { m370C.y = rope->current.pos.y - 700.0f; } else { mGndChk.SetPos(&rope->current.pos); @@ -517,7 +516,7 @@ BOOL daPy_lk_c::procRopeReady() { cXyz local_48 = m370C - current.pos; f32 dVar5 = local_48.abs(); cLib_chaseF(&m35A0, 50.0f, 5.0f); - shape_angle.x = (0.025f * (mProcVar2.m34D4 * m35A0)); + shape_angle.x = mProcVar2.m34D4 * m35A0 * 0.025f; if (dVar5 > m35A0) { current.pos += local_48 * (m35A0 / dVar5); } @@ -528,35 +527,35 @@ BOOL daPy_lk_c::procRopeReady() { } /* 80144620-80144C58 .text procRopeSwing_init__9daPy_lk_cFP10fopAc_ac_cs */ -BOOL daPy_lk_c::procRopeSwing_init(fopAc_ac_c* param_0, s16 param_1) { - himo2_class* pfVar7 = (himo2_class*)param_0; +BOOL daPy_lk_c::procRopeSwing_init(fopAc_ac_c* rope_actor, s16 param_1) { + fopAc_ac_c* i_rope_actor = rope_actor; commonProcInit(daPyProc_ROPE_SWING_e); cXyz local_84; - if (param_0 != NULL) { - mActorKeepRope.setData(param_0); - if (fopAcM_GetName(param_0) == fpcNm_HIMO3_e) { - fopAcM_SetParam(param_0, 1); + if (rope_actor != NULL) { + mActorKeepRope.setData(rope_actor); + if (fopAcM_GetName(rope_actor) == fpcNm_HIMO3_e) { + himo3_class* rope = (himo3_class*)rope_actor; + fopAcM_SetParam(rope_actor, 1); deleteEquipItem(TRUE); mEquipItem = dItemNo_GRAPPLING_HOOK_e; - local_84 = param_0->current.pos - current.pos; - f32 dVar8 = (local_84.abs() - 95.0f); - cXyz* temp = &((himo2_class*)param_0)->m1120[34].m10; - if (dVar8 > DEMO_SELECT(temp->z, temp->y)) { - dVar8 = DEMO_SELECT(temp->z, temp->y); + local_84 = rope_actor->current.pos - current.pos; + f32 dVar8 = local_84.abs() - 95.0f; + if (dVar8 > rope->getPlayerMoveLength()) { + dVar8 = rope->getPlayerMoveLength(); } local_84.normalize(); - current.pos = (param_0->current.pos - (local_84 * dVar8)); + current.pos = rope_actor->current.pos - local_84 * dVar8; } } else { - param_0 = mActorKeepRope.getActor(); + rope_actor = mActorKeepRope.getActor(); } - local_84 = param_0->current.pos - current.pos; + local_84 = rope_actor->current.pos - current.pos; m35A0 = local_84.abs(); m35A4 = std::sqrtf(2.0f / m35A0); f32 dVar11 = (M_PI / 2.0f) / m35A4; - if (pfVar7 != NULL) { + if (i_rope_actor != NULL) { mProcVar2.m34D4 = m_HIO->mItem.mRope.m.field_0x0; if (DEMO_SELECT(!strcmp(dComIfGp_getStartStageName(), "GanonK"), checkSpecialRope())) { mProcVar2.m34D4 /= DEMO_SELECT(3, 8.0f); @@ -574,7 +573,7 @@ BOOL daPy_lk_c::procRopeSwing_init(fopAc_ac_c* param_0, s16 param_1) { sVar4 = -mProcVar2.m34D4; } - f32 dVar8 = ((f32)sVar4 / mProcVar2.m34D4); + f32 dVar8 = (f32)sVar4 / mProcVar2.m34D4; m35A8 = cM_atan2f(dVar8, std::sqrtf(1.0f - (dVar8 * dVar8))) / m35A4; f32 dVar8_3 = std::sqrtf(local_78.y * local_78.y + local_78.z * local_78.z); mProcVar3.m34D6 = cM_atan2s(-local_78.x, dVar8_3); @@ -597,21 +596,21 @@ BOOL daPy_lk_c::procRopeSwing_init(fopAc_ac_c* param_0, s16 param_1) { mNormalSpeed = 0.0f; speed.y = 0.0f; gravity = 0.0f; - mRopePos = param_0->current.pos; + mRopePos = rope_actor->current.pos; dComIfGp_setPlayerStatus0(0, daPyStts0_UNK800000_e); - if ((pfVar7 == NULL) || (mActorKeepEquip.getActor() != NULL)) { + if (i_rope_actor == NULL || mActorKeepEquip.getActor() != NULL) { offModeFlg(ModeFlg_00000400); onModeFlg(ModeFlg_00000100); setTextureAnime(8, 0); } else { setBlendRopeMoveAnime(1); } - if (pfVar7 == NULL) { + if (i_rope_actor == NULL) { m_old_fdata->initOldFrameMorf(15.0f, 0, 0x2A); } mFrameCtrlUnder[UNDER_MOVE0_e].setStart(m_HIO->mItem.mRope.m.field_0x1C); mFrameCtrlUnder[UNDER_MOVE0_e].setEnd(m_HIO->mItem.mRope.m.field_0x4); - if ((pfVar7 != NULL) && (mActorKeepEquip.getActor() == NULL)) { + if (i_rope_actor != NULL && mActorKeepEquip.getActor() == NULL) { mAnmRatioUnder[UNDER_MOVE0_e].getAnmTransform()->setFrame(mFrameCtrlUnder[UNDER_MOVE0_e].getFrame()); } mProcVar0.m34D0 = 0; @@ -642,14 +641,14 @@ BOOL daPy_lk_c::procRopeSwing() { f32 f30_2; #if VERSION == VERSION_DEMO if (strcmp(dComIfGp_getStartStageName(), "GanonK") == 0) { - if ((0.0f <= f30) && (f30 <= M_PI / 2)) { + if (0.0f <= f30 && f30 <= M_PI / 2) { f30_2 = -0.1f * cM_fsin(f30); } else if (f30 <= -M_PI / 2) { f30_2 = 0.1f * cM_fsin(f30); } else { f30_2 = 0.25f; } - if ((0.0f <= dVar13) && (dVar13 <= M_PI / 2)) { + if (0.0f <= dVar13 && dVar13 <= M_PI / 2) { dVar13 = -0.1f * cM_fsin(dVar13); } else if (dVar13 <= -M_PI / 2) { dVar13 = 0.1f * cM_fsin(dVar13); @@ -664,14 +663,14 @@ BOOL daPy_lk_c::procRopeSwing() { } #endif else { - if ((0.0f <= f30) && (f30 <= M_PI / 2)) { + if (0.0f <= f30 && f30 <= M_PI / 2) { f30_2 = -0.45f * cM_fsin(f30); } else if (f30 <= -M_PI / 2) { f30_2 = 0.45f * cM_fsin(f30); } else { f30_2 = 0.0f; } - if ((0.0f <= dVar13) && (dVar13 <= M_PI / 2)) { + if (0.0f <= dVar13 && dVar13 <= M_PI / 2) { dVar13 = -0.45f * cM_fsin(dVar13); } else if (dVar13 <= -M_PI / 2) { dVar13 = 0.45f * cM_fsin(dVar13); @@ -692,7 +691,7 @@ BOOL daPy_lk_c::procRopeSwing() { f30_2 = f30_2 - M_PI * 2; m35AC = f30_2 / m35A4; } - if ((checkModeFlg(ModeFlg_00000400)) && (mFrameCtrlUnder[UNDER_MOVE0_e].getRate() < 0.01f)) { + if (checkModeFlg(ModeFlg_00000400) && mFrameCtrlUnder[UNDER_MOVE0_e].getRate() < 0.01f) { offModeFlg(ModeFlg_00000400); onModeFlg(ModeFlg_00000100); setTextureAnime(8, 0); @@ -768,9 +767,9 @@ BOOL daPy_lk_c::procRopeSwing() { } } - f32 f30_3 = ((f32)mProcVar2.m34D4 / r30); + f32 f30_3 = (f32)mProcVar2.m34D4 / r30; if (changeRopeEndProc(0)) { - dVar13 = (m35A0 / (100.0f * m_HIO->mItem.mRope.m.field_0x14)); + dVar13 = m35A0 / (100.0f * m_HIO->mItem.mRope.m.field_0x14); if (dVar13 < 1.0f) { dVar13 = 1.0f; } @@ -782,7 +781,7 @@ BOOL daPy_lk_c::procRopeSwing() { speed.y = m_HIO->mItem.mRope.m.field_0x10 * f30_3; procFall_init(0, m_HIO->mWallCatch.m.field_0x54); onNoResetFlg1(daPyFlg1_UNK8000000); - } else if ((mProcVar2.m34D4 == 0) && (mProcVar3.m34D6 == 0)) { + } else if (mProcVar2.m34D4 == 0 && mProcVar3.m34D6 == 0) { procRopeHangWait_init(0); } else if (f30_3 > 0.6f) { if (cM_fcos(sp0C) > 0.77f) { @@ -881,7 +880,7 @@ BOOL daPy_lk_c::procRopeHangWait() { ); } } - } else if ((direction == DIR_FORWARD) || (direction == DIR_BACKWARD)) { + } else if (direction == DIR_FORWARD || direction == DIR_BACKWARD) { procRopeSwingStart_init(); } else { r29 = 0; @@ -1042,10 +1041,8 @@ BOOL daPy_lk_c::procRopeDown_init() { } } } else { - himo2_class* rope = (himo2_class*)mActorKeepRope.getActor(); - cXyz* temp = &rope->m1120[34].m10; - f32 temp2 = DEMO_SELECT(temp->z, temp->y); - m35A4 = mRopePos.y - temp2; + himo3_class* rope = (himo3_class*)mActorKeepRope.getActor(); + m35A4 = mRopePos.y - rope->getPlayerMoveLength(); } if (current.pos.y <= m35A4) { @@ -1186,11 +1183,11 @@ BOOL daPy_lk_c::procRopeMove() { if (!checkItemModeActorPointer()) { return true; } - if ((fopAcM_GetParam(mActorKeepEquip.getActor()) == 0) && (checkRopeReadyAnime())) { + if (fopAcM_GetParam(mActorKeepEquip.getActor()) == 0 && checkRopeReadyAnime()) { if (mpAttnActorLockOn != NULL) { setSpeedAndAngleAtnActor(); } else { - if ((m355E == 0) && (!checkAttentionLock())) { + if (m355E == 0 && !checkAttentionLock()) { resetActAnimeUpper(UPPER_MOVE2_e, -1.0f); } else { setSpeedAndAngleAtn(); @@ -1243,7 +1240,7 @@ BOOL daPy_lk_c::procRopeThrowCatch() { if (mFrameCtrlUnder[UNDER_MOVE0_e].getRate() < 0.01f) { mProcVar0.m34D0--; himo2_class* rope = (himo2_class*)mActorKeepEquip.getActor(); - if (rope->m02DC == 0 || (mProcVar0.m34D0 == 0)) { + if (rope->m02DC == 0 || mProcVar0.m34D0 == 0) { checkNextRopeMode(); } } diff --git a/src/d/actor/d_a_player_ship.inc b/src/d/actor/d_a_player_ship.inc index ae4dc27a1..0a5f02ff5 100644 --- a/src/d/actor/d_a_player_ship.inc +++ b/src/d/actor/d_a_player_ship.inc @@ -1055,26 +1055,13 @@ BOOL daPy_lk_c::procShipCrane() { mProcVar2.m34D4 = 1; daPy_ANM anm; if (ship->getCraneBaseAngle() > 0) { - // TODO: is this salvage type stuff an inline? - int type; - if (daSalvage_c::isValidSalvageId()) { - type = daSalvage_c::mTagData_p->getType(daSalvage_c::getSalvageId()); - } else { - type = -1; - } - if (type == 1) { + if (daSalvage_c::getSalvageKind() == 1) { anm = ANM_SALVRGOOD; } else { anm = ANM_SALVRBAD; } } else { - int type; - if (daSalvage_c::isValidSalvageId()) { - type = daSalvage_c::mTagData_p->getType(daSalvage_c::getSalvageId()); - } else { - type = -1; - } - if (type == 1) { + if (daSalvage_c::getSalvageKind() == 1) { anm = ANM_SALVLGOOD; } else { anm = ANM_SALVLBAD; diff --git a/src/d/actor/d_a_player_tact.inc b/src/d/actor/d_a_player_tact.inc index dc3b8a5c9..686dce374 100644 --- a/src/d/actor/d_a_player_tact.inc +++ b/src/d/actor/d_a_player_tact.inc @@ -514,9 +514,9 @@ BOOL daPy_lk_c::procTactPlay_init(s32 r27, int r30, int r31) { dComIfGp_setPlayerStatus1(0, daPyStts1_WIND_WAKER_CONDUCT_e); mProcVar6.m3570 = r27; if (r31 == 0) { - m3628 = fopMsgM_messageSet(0x5AD + r27); + mGameOverId = fopMsgM_messageSet(0x5AD + r27); } else { - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; } mDoAud_tact_setVolume(0.0f); resetActAnimeUpper(UPPER_MOVE2_e, -1.0f); @@ -590,14 +590,14 @@ BOOL daPy_lk_c::procTactPlay() { return TRUE; } - msg_class* msg_p = fopMsgM_SearchByID(m3628); + msg_class* msg_p = fopMsgM_SearchByID(mGameOverId); if (msg_p == NULL || msg_p->mStatus == fopMsgStts_BOX_CLOSED_e) { fopAc_ac_c* tactZevPartner = NULL; dComIfGp_setMetronomeOff(); if (msg_p != NULL) { msg_p->mStatus = fopMsgStts_MSG_DESTROYED_e; - m3628 = fpcM_ERROR_PROCESS_ID_e; + mGameOverId = fpcM_ERROR_PROCESS_ID_e; } if (mTactZevPartnerId != fpcM_ERROR_PROCESS_ID_e && m34CC == mProcVar6.m3570) { diff --git a/src/d/d_cc_s.cpp b/src/d/d_cc_s.cpp index 005566626..a607d5a77 100644 --- a/src/d/d_cc_s.cpp +++ b/src/d/d_cc_s.cpp @@ -493,7 +493,7 @@ bool dCcS::ChkCamera(cXyz& start, cXyz& end, f32 radius, fopAc_ac_c* r26, fopAc_ continue; if ((*pObjCo)->GetAc() == r26 || (*pObjCo)->GetAc() == r27) continue; - if ((*pObjCo)->GetDivideInfo().Chk(divideInfo)) { + if ((*pObjCo)->GetPDivideInfo()->Chk(divideInfo)) { cCcD_ShapeAttr* shapeAttr = (*pObjCo)->GetShapeAttr(); if (shapeAttr == NULL) continue;