From 25e69da75e7c76b3b65ec1ecd6a4cfecfeaf65be Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sat, 20 Jan 2024 19:27:19 -0500 Subject: [PATCH] d_cc_uty OK --- configure.py | 2 +- include/d/actor/d_a_mt.h | 5 +- include/d/actor/d_a_player.h | 4 +- include/d/actor/d_a_tsubo.h | 16 +- include/d/d_cc_d.h | 12 +- include/d/d_cc_uty.h | 10 +- include/d/d_s_play.h | 4 + include/f_op/f_op_actor.h | 14 +- include/f_op/f_op_actor_mng.h | 2 + include/m_Do/m_Do_audio.h | 4 + src/c/c_damagereaction.cpp | 6 +- src/d/actor/d_a_am.cpp | 4 +- src/d/actor/d_a_am2.cpp | 4 +- src/d/actor/d_a_arrow.cpp | 4 +- src/d/actor/d_a_bk.cpp | 2 +- src/d/actor/d_a_hookshot.cpp | 2 +- src/d/actor/d_a_obj_akabe.cpp | 2 +- src/d/actor/d_a_player_main.cpp | 30 +-- src/d/actor/d_a_player_main_data.inc | 4 +- src/d/actor/d_a_rd.cpp | 4 +- src/d/d_cc_uty.cpp | 265 +++++++++++++++++++++++++-- src/d/d_kankyo_rain.cpp | 2 +- src/f_op/f_op_actor_mng.cpp | 2 +- 23 files changed, 337 insertions(+), 67 deletions(-) diff --git a/configure.py b/configure.py index dc5155d96..3423880c6 100644 --- a/configure.py +++ b/configure.py @@ -400,7 +400,7 @@ config.libs = [ Object(Matching, "d/d_cc_d.cpp"), Object(NonMatching, "d/d_cc_mass_s.cpp"), Object(NonMatching, "d/d_cc_s.cpp"), - Object(NonMatching, "d/d_cc_uty.cpp"), + Object(Matching, "d/d_cc_uty.cpp"), Object(NonMatching, "d/d_cam_param.cpp"), Object(NonMatching, "d/d_cam_type.cpp"), Object(NonMatching, "d/d_cam_style.cpp"), diff --git a/include/d/actor/d_a_mt.h b/include/d/actor/d_a_mt.h index 951bb5263..80bc0113a 100644 --- a/include/d/actor/d_a_mt.h +++ b/include/d/actor/d_a_mt.h @@ -3,9 +3,12 @@ #include "f_op/f_op_actor.h" -class mt_class : public fopAc_ac_c { +class mt_class : public fopEn_enemy_c { public: /* Place member variables here */ + /* 0x02AC */ u8 m2AC[0x0454 - 0x02AC]; + /* 0x0454 */ u8 m454; + /* 0x0455 */ u8 m455[0x1CC0 - 0x0455]; }; class daMt_HIO_c { diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index f8270b3ff..d7facf953 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -337,7 +337,7 @@ public: }; /* 0x290 */ u8 mCutType; - /* 0x291 */ u8 field_0x291; + /* 0x291 */ u8 mCutCount; /* 0x292 */ u8 field_0x292[0x294 - 0x292]; /* 0x294 */ s16 mDamageWaitTimer; /* 0x296 */ s16 mQuakeTimer; @@ -361,6 +361,7 @@ public: f32 getSpeedF() const { return speedF; } u8 getCutType() const { return mCutType; } + u8 getCutCount() const { return mCutCount; } s16 getDamageWaitTimer() const { return mDamageWaitTimer; } f32 getHeight() const { return mHeight; } s16 getBodyAngleX() const { return mBodyAngle.x; } @@ -371,7 +372,6 @@ public: cXyz getLeftHandPos() const { return mLeftHandPos; } cXyz getRightHandPos() const { return mRightHandPos; } cXyz getRopePos() const { return mRopePos; } - void getCutCount() const {} // field_0x291? void getYPos() const {} void changeDemoMode(u32) {} diff --git a/include/d/actor/d_a_tsubo.h b/include/d/actor/d_a_tsubo.h index 0eb2f4210..3a0888b41 100644 --- a/include/d/actor/d_a_tsubo.h +++ b/include/d/actor/d_a_tsubo.h @@ -7,26 +7,38 @@ #include "d/d_bg_s_acch.h" #include "SSystem/SComponent/c_bg_s_poly_info.h" #include "d/d_particle.h" +#include "d/d_a_obj.h" #include "SSystem/SComponent/c_angle.h" #include "SSystem/SComponent/c_phase.h" namespace daTsubo { class Act_c : public fopAc_ac_c { public: + enum Prm_e { + PRM_TYPE_W = 0x04, + PRM_TYPE_S = 0x18, + }; + + enum Type { + TYPE_WATER_JUG = 0x2, + TYPE_KUTANI = 0xE, + }; + + int prm_get_type() const { return daObj::PrmAbstract(this, PRM_TYPE_W, PRM_TYPE_S); } + bool prm_chk_type_kutani() const { return prm_get_type() == TYPE_KUTANI; } + void attrSpine() {} void data() const {} void data_spec_boko(int) {} void is_switch() const {} void pos_init() {} void prmZ_get_swSave() const {} - void prm_chk_type_kutani() const {} void prm_get_cull() const {} void prm_get_itemNo() const {} void prm_get_itemSave() const {} void prm_get_moveBg() const {} void prm_get_spec() const {} void prm_get_stick() const {} - void prm_get_type() const {} void prm_make_acorn(bool, int, int) {} void prm_make_skull() {} void prm_make_yw1() {} diff --git a/include/d/d_cc_d.h b/include/d/d_cc_d.h index e5c1b1004..24b069beb 100644 --- a/include/d/d_cc_d.h +++ b/include/d/d_cc_d.h @@ -29,7 +29,17 @@ enum dCcG_Co_SPrm { G_CO_SPRM_TG_LASSO = 0x02, }; -enum dCcD_hitSe {}; +enum dCcD_hitSe { + /* 0x01 */ dCcD_SE_UNK1 = 1, + /* 0x02 */ dCcD_SE_UNK2 = 2, + /* 0x04 */ dCcD_SE_UNK4 = 4, + /* 0x05 */ dCcD_SE_UNK5 = 5, + /* 0x06 */ dCcD_SE_UNK6 = 6, + /* 0x07 */ dCcD_SE_ARROW = 7, + /* 0x08 */ dCcD_SE_HOOKSHOT = 8, + /* 0x23 */ dCcD_SE_UNK23 = 0x23, + /* 0x25 */ dCcD_SE_UNK25 = 0x25, +}; enum CcG_At_HitMark { /* 0xD */ G_AT_MARK_NORMAL_HIT = dPa_name::ID_COMMON_NORMAL_HIT, diff --git a/include/d/d_cc_uty.h b/include/d/d_cc_uty.h index 6757b35de..d55f371e8 100644 --- a/include/d/d_cc_uty.h +++ b/include/d/d_cc_uty.h @@ -23,12 +23,12 @@ public: /* 0x18 */ s32 mHitSoundId; }; -void cc_pl_cut_bit_get(); -void at_se_get(cCcD_Obj*); -void at_se_getC(cCcD_Obj*); +int cc_pl_cut_bit_get(); +u32 at_se_get(cCcD_Obj*); +u32 at_se_getC(cCcD_Obj*); void def_se_set(fopAc_ac_c*, cCcD_Obj*, unsigned long); void def_se_set_p(fopAc_ac_c*, cXyz*, cCcD_Obj*, unsigned long); -void at_power_check(CcAtInfo*); -void cc_at_check(fopAc_ac_c*, CcAtInfo*); +fopAc_ac_c* at_power_check(CcAtInfo*); +fopAc_ac_c* cc_at_check(fopAc_ac_c*, CcAtInfo*); #endif /* D_CC_UTY_H */ diff --git a/include/d/d_s_play.h b/include/d/d_s_play.h index fba08c8cd..9991ef7b9 100644 --- a/include/d/d_s_play.h +++ b/include/d/d_s_play.h @@ -6,6 +6,7 @@ #include "m_Do/m_Do_hostIO.h" class mDoDvdThd_toMainRam_c; + class dScnPly_ply_c : public scene_class { public: s8 calcPauseTimer(); @@ -15,6 +16,9 @@ public: static bool isPause() { return pauseTimer != 0; } static void setPauseTimer(s8 time) { nextPauseTimer = time; } + static void onDebugPause() {} + static void offDebugPause() {} + static s8 pauseTimer; static s8 nextPauseTimer; diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index 4804230ad..a125c70b0 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -23,25 +23,25 @@ struct actor_method_class2 { enum fopAc_Status_e { // Note: The lowest 5 bits of the status field (& 0x1F) act as an index controlling the map icon type. fopAcStts_SHOWMAP_e = 0x00000020, - fopAcStts_UNK40_e = 0x00000040, + fopAcStts_UNK40_e = 0x00000040, // Related to talking to the Killer Bees? fopAcStts_NOCULLEXEC_e = 0x00000080, fopAcStts_CULL_e = 0x00000100, fopAcStts_FREEZE_e = 0x00000400, fopAcStts_UNK800_e = 0x00000800, - fopAcStts_UNK1000_e = 0x00001000, + fopAcStts_UNK1000_e = 0x00001000, // Door related fopAcStts_CARRY_e = 0x00002000, fopAcStts_UNK4000_e = 0x00004000, fopAcStts_FORCEMOVE_e = 0x00008000, fopAcStts_NOPAUSE_e = 0x00020000, fopAcStts_UNK40000_e = 0x00040000, - fopAcStts_UNK80000_e = 0x00080000, + fopAcStts_UNK80000_e = 0x00080000, // Hookshot related fopAcStts_HOOK_CARRY_e = 0x00100000, - fopAcStts_UNK200000_e = 0x00200000, + fopAcStts_UNK200000_e = 0x00200000, // Hookshot related fopAcStts_NODRAW_e = 0x01000000, fopAcStts_UNK2000000_e = 0x02000000, fopAcStts_BOSS_e = 0x04000000, fopAcStts_UNK8000000_e = 0x08000000, - fopAcStts_UNK10000000_e = 0x10000000, + fopAcStts_UNK10000000_e = 0x10000000, // Hookshot related }; enum fopAc_Condition_e { @@ -281,8 +281,8 @@ public: /* 0x284 */ s8 mMaxHealth; /* 0x285 */ s8 mHealth; /* 0x288 */ s32 mItemTableIdx; - /* 0x28C */ u8 mItemStealNum; - /* 0x28D */ s8 mItemStealLeft; + /* 0x28C */ u8 mStealItemBitNo; // For limited items (Blue Chu Jelly), this is the first itemBitNo to set. + /* 0x28D */ s8 mStealItemLeft; fopAc_ac_c(); ~fopAc_ac_c(); diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index a17c91801..3bacb9d2f 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -534,6 +534,8 @@ void* fopAcM_fastCreateItem(cXyz* p_pos, int i_itemNo, int i_roomNo, csXyz* p_an cXyz* p_scale, f32 p_speedF, f32 p_speedY, f32 param_8, int param_9 = -1, createFunc p_createFunc = NULL); +void* fopAcM_createStealItem(cXyz* p_pos, int i_tblNo, int i_roomNo, csXyz* p_angle, int i_itemBitNo); + BOOL stealItem_CB(void* actor); fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo); diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h index 78d10580a..394e3e525 100644 --- a/include/m_Do/m_Do_audio.h +++ b/include/m_Do/m_Do_audio.h @@ -165,6 +165,10 @@ inline void mDoAud_bgmMuteMtDragon() { mDoAud_zelAudio_c::getInterface()->bgmMuteMtDragon(); } +inline void mDoAud_bgmHitSound(s32 param_0) { + mDoAud_zelAudio_c::getInterface()->bgmHitSound(param_0); +} + inline void mDoAud_stSkyCloisters() { mDoAud_zelAudio_c::getInterface()->stSkyCloisters(); } diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index b0ba43954..094a7b1d1 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -87,7 +87,7 @@ dCcD_SrcCyl cc_cyl_src = { /* SrcGObjAt Spl */ 0, /* SrcGObjAt Mtrl */ 0, /* SrcGObjAt SPrm */ 0, - /* SrcGObjTg Se */ 0x05, + /* SrcGObjTg Se */ dCcD_SE_UNK5, /* SrcGObjTg HitMark */ G_TG_MARK_PURPLE_HIT, /* SrcGObjTg Spl */ 0, /* SrcGObjTg Mtrl */ 0, @@ -158,7 +158,7 @@ BOOL enemy_ice(enemyice* ei) { if (fopAcM_GetName(ac) != PROC_PZ) { // If the actor is not Princess Zelda, drop an item ball. // TODO: Why the Zelda check? Is she coded to be able to die to Light Arrows? - fopAcM_createIball(&pos, ac->mItemTableIdx, fopAcM_GetRoomNo(ac), &ac->current.angle, ac->mItemStealNum); + fopAcM_createIball(&pos, ac->mItemTableIdx, fopAcM_GetRoomNo(ac), &ac->current.angle, ac->mStealItemBitNo); } if (ei->mDeathSwitch != 0) { dComIfGs_onSwitch(ei->mDeathSwitch, fopAcM_GetRoomNo(ac)); @@ -336,7 +336,7 @@ BOOL enemy_ice(enemyice* ei) { } fopAcM_seStart(ac, JA_SE_CM_ICE_BREAK, 0); - fopAcM_createIball(&pos, ac->mItemTableIdx, fopAcM_GetRoomNo(ac), &ac->current.angle, ac->mItemStealNum); + fopAcM_createIball(&pos, ac->mItemTableIdx, fopAcM_GetRoomNo(ac), &ac->current.angle, ac->mStealItemBitNo); ei->mFreezeTimer = 0; if (ei->mDeathSwitch != 0) { dComIfGs_onSwitch(ei->mDeathSwitch, fopAcM_GetRoomNo(ac)); diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index 732cced54..24f0fed77 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -260,7 +260,7 @@ static BOOL medama_atari_check(am_class* i_this) { switch (hitObj->GetAtType()) { case AT_TYPE_GRAPPLING_HOOK: if (i_this->mCurrBckIdx != AM_BCK_SLEEP && i_this->mCurrBckIdx != AM_BCK_SLEEP_LOOP) { - if (i_this->mItemStealLeft > 0) { + if (i_this->mStealItemLeft > 0) { i_this->mMaxHealth = 10; i_this->mHealth = 10; atInfo.mpObj = i_this->mEyeSph.GetTgHitObj(); @@ -1192,7 +1192,7 @@ static s32 daAM_Create(fopAc_ac_c* i_actor) { return cPhs_ERROR_e; } - i_this->mItemStealLeft = 3; + i_this->mStealItemLeft = 3; i_this->mSmokeCbs[0].setRateOff(0); i_this->mSmokeCbs[1].setRateOff(0); diff --git a/src/d/actor/d_a_am2.cpp b/src/d/actor/d_a_am2.cpp index 138756245..e6831e8c7 100644 --- a/src/d/actor/d_a_am2.cpp +++ b/src/d/actor/d_a_am2.cpp @@ -168,7 +168,7 @@ static BOOL medama_atari_check(am2_class* i_this) { if (hitObj->GetAtType() & AT_TYPE_GRAPPLING_HOOK) { if (i_this->mCurrBckIdx != AM2_BCK_SLEEP) { - if (i_this->mItemStealLeft > 0) { + if (i_this->mStealItemLeft > 0) { s8 origHealth = i_this->mHealth; i_this->mHealth = 10; atInfo.mpObj = i_this->mEyeSph.GetTgHitObj(); @@ -1338,7 +1338,7 @@ static s32 daAM2_Create(fopAc_ac_c* i_actor) { i_this->mItemTableIdx = dComIfGp_CharTbl()->GetNameIndex("amos2", 0); i_this->mMaxHealth = 2; i_this->mHealth = 2; - i_this->mItemStealLeft = 3; + i_this->mStealItemLeft = 3; i_this->model = i_this->mpMorf->getModel(); fopAcM_SetMtx(i_this, i_this->mpMorf->mpModel->getBaseTRMtx()); diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index 6dab73289..ea775d5b8 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -33,7 +33,7 @@ const dCcD_SrcCps daArrow_c::m_at_cps_src = { /* SrcObjTg Type */ 0, /* SrcObjTg SPrm */ 0, /* SrcObjCo SPrm */ 0, - /* SrcGObjAt Se */ 0x07, + /* SrcGObjAt Se */ dCcD_SE_ARROW, /* SrcGObjAt HitMark */ G_AT_MARK_NORMAL_HIT, /* SrcGObjAt Spl */ 0, /* SrcGObjAt Mtrl */ 0, @@ -63,7 +63,7 @@ const dCcD_SrcSph daArrow_c::m_co_sph_src = { /* SrcObjTg Type */ 0, /* SrcObjTg SPrm */ 0, /* SrcObjCo SPrm */ CO_SPRM_SET | CO_SPRM_IS_UNK8 | CO_SPRM_VS_UNK2 | CO_SPRM_NO_CRR, - /* SrcGObjAt Se */ 0x07, + /* SrcGObjAt Se */ dCcD_SE_ARROW, /* SrcGObjAt HitMark */ 0, /* SrcGObjAt Spl */ 0, /* SrcGObjAt Mtrl */ 0, diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index ab5c2a487..ecddbacee 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -863,7 +863,7 @@ static s32 daBk_Create(fopAc_ac_c* i_actor) { i_this->mEnemyFire.mParticleScale[i] = fire_sc[i]; } - i_this->mItemStealLeft = 3; + i_this->mStealItemLeft = 3; daBk_Execute(i_this); } diff --git a/src/d/actor/d_a_hookshot.cpp b/src/d/actor/d_a_hookshot.cpp index b2ef9d271..9378a900c 100644 --- a/src/d/actor/d_a_hookshot.cpp +++ b/src/d/actor/d_a_hookshot.cpp @@ -343,7 +343,7 @@ static dCcD_SrcCps l_at_cps_src = { /* SrcObjTg Type */ 0, /* SrcObjTg SPrm */ 0, /* SrcObjCo SPrm */ 0, - /* SrcGObjAt Se */ 0x08, + /* SrcGObjAt Se */ dCcD_SE_HOOKSHOT, /* SrcGObjAt HitMark */ 0, /* SrcGObjAt Spl */ 0, /* SrcGObjAt Mtrl */ 0, diff --git a/src/d/actor/d_a_obj_akabe.cpp b/src/d/actor/d_a_obj_akabe.cpp index 9ef730bba..3d63fa4d1 100644 --- a/src/d/actor/d_a_obj_akabe.cpp +++ b/src/d/actor/d_a_obj_akabe.cpp @@ -21,7 +21,7 @@ namespace daObjAkabe { /* 00000078-0000009C .text solidHeapCB__Q210daObjAkabe5Act_cFP10fopAc_ac_c */ BOOL Act_c::solidHeapCB(fopAc_ac_c* i_this) { - return ((Act_c*)i_this)->create_heap() & 0xFF; // Fakematch + return ((Act_c*)i_this)->create_heap() & 0xFF; // Fakematch (see comment in create_heap) } /* 0000009C-000001A4 .text create_heap__Q210daObjAkabe5Act_cFv */ diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 23fb0c866..a9415712c 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -1749,7 +1749,7 @@ BOOL daPy_lk_c::changeDamageProc() { } BOOL r30; - int r29; + int damage; s32 r28 = dBgS_Attr_NORMAL_e; if (checkNoResetFlg1(daPyFlg1_UNK4) || ( @@ -1781,12 +1781,12 @@ BOOL daPy_lk_c::changeDamageProc() { if (r28 != dBgS_Attr_NORMAL_e) { r30 = TRUE; - r29 = 1; + damage = 1; } else { r30 = FALSE; - r29 = mStts.GetDmg(); - if (mCyl.ChkTgHit() && mCyl.GetTgHitGObj() && mCyl.GetTgHitGObj()->GetAtType() == 0x20) { - r29 = 1; + damage = mStts.GetDmg(); + if (mCyl.ChkTgHit() && mCyl.GetTgHitGObj() && mCyl.GetTgHitGObj()->GetAtType() == AT_TYPE_BOMB) { + damage = 1; } } @@ -1804,7 +1804,7 @@ BOOL daPy_lk_c::changeDamageProc() { if (checkModeFlg(ModeFlg_04000000)) { if (r30 || mCyl.ChkTgHit() && !checkSuccessGuard(r27)) { - setDamagePoint(-r29); + setDamagePoint(-damage); mDamageWaitTimer = daPy_HIO_dam_c0::m.field_0x2; voiceStart(2); @@ -1828,7 +1828,7 @@ BOOL daPy_lk_c::changeDamageProc() { } } } else { - if (mAtCps[0].GetAtType() != 0x80 && mAtCps[0].GetAtType() != 0x100) { + if (mAtCps[0].GetAtType() != AT_TYPE_BOKO_STICK && mAtCps[0].GetAtType() != AT_TYPE_WATER) { cXyz sp8; if (checkElecReturnDamage(&mAtCps[0], &sp8) || checkElecReturnDamage(&mAtCps[1], &sp8) || @@ -1864,7 +1864,7 @@ BOOL daPy_lk_c::changeDamageProc() { setDamageEmitter(); changePlayer(this); - setDamagePoint(-r29); + setDamagePoint(-damage); fopAc_ac_c* grabActor = mActorKeepGrab.getActor(); if (daPy_dmEcallBack_c::checkElec()) { if (procElecDamage_init(NULL)) { @@ -1891,17 +1891,17 @@ BOOL daPy_lk_c::changeDamageProc() { if (daPy_lk_c::checkPlayerFly() || r27 == 6 || r27 == 1 || r27 == 9) { return procLargeDamage_init(-1, 1, 0, 0); } - if (checkNormalDamage(r29)) { + if (checkNormalDamage(damage)) { return procDamage_init(); } setDashDamage(); } else { u8 hitSe = mCyl.GetTgHitObjSe(); - if (hitSe == 6) { + if (hitSe == dCcD_SE_UNK6) { seStartOnlyReverb(JA_SE_OBJ_COL_N_BDY_MPLT); - } else if (hitSe == 2 || hitSe == 5) { + } else if (hitSe == dCcD_SE_UNK2 || hitSe == dCcD_SE_UNK5) { seStartOnlyReverb(JA_SE_OBJ_COL_SWS_NMTLP); - } else if (hitSe == 4) { + } else if (hitSe == dCcD_SE_UNK4) { seStartOnlyReverb(JA_SE_OBJ_COL_NWHP_NMTL); } else { seStartOnlyReverb(JA_SE_OBJ_COL_SWM_NSWL); @@ -1918,7 +1918,7 @@ BOOL daPy_lk_c::changeDamageProc() { if (mHeldItemType == 0x101) { deleteEquipItem(FALSE); } - setDamagePoint(-r29); + setDamagePoint(-damage); if (r28 == dBgS_Attr_ELECTRICITY_e) { setDamageElecEmitter(); @@ -1927,7 +1927,7 @@ BOOL daPy_lk_c::changeDamageProc() { } } - if (checkNormalDamage(r29)) { + if (checkNormalDamage(damage)) { return procPolyDamage_init(); } @@ -2790,7 +2790,7 @@ void daPy_lk_c::setAtParam(u32 type, int atp, dCcG_At_Spl spl, u8 se, u8 hitMark atp *= 2; } if (type != AT_TYPE_SWORD) { - field_0x291 = 0; + mCutCount = 0; } for (int i = 0; i < ARRAY_SIZE(mAtCps); i++, cps++) { cps->SetAtType(type); diff --git a/src/d/actor/d_a_player_main_data.inc b/src/d/actor/d_a_player_main_data.inc index 3349f89fc..adf4fd33e 100644 --- a/src/d/actor/d_a_player_main_data.inc +++ b/src/d/actor/d_a_player_main_data.inc @@ -57,7 +57,7 @@ static dCcD_SrcCyl l_cyl_src = { /* SrcGObjAt Spl */ 0, /* SrcGObjAt Mtrl */ 0, /* SrcGObjAt SPrm */ 0, - /* SrcGObjTg Se */ 0x25, + /* SrcGObjTg Se */ dCcD_SE_UNK25, /* SrcGObjTg HitMark */ G_TG_MARK_PURPLE_HIT, /* SrcGObjTg Spl */ 0, /* SrcGObjTg Mtrl */ 0, @@ -142,7 +142,7 @@ static dCcD_SrcCps l_at_cps_src = { /* SrcObjTg Type */ 0, /* SrcObjTg SPrm */ 0, /* SrcObjCo SPrm */ 0, - /* SrcGObjAt Se */ 0x01, + /* SrcGObjAt Se */ dCcD_SE_UNK1, /* SrcGObjAt HitMark */ G_AT_MARK_NORMAL_HIT, /* SrcGObjAt Spl */ 0, /* SrcGObjAt Mtrl */ 0, diff --git a/src/d/actor/d_a_rd.cpp b/src/d/actor/d_a_rd.cpp index 5611faed8..0f0661a8d 100644 --- a/src/d/actor/d_a_rd.cpp +++ b/src/d/actor/d_a_rd.cpp @@ -45,7 +45,7 @@ const dCcD_SrcCyl daRd_c::m_cyl_src = { /* SrcGObjAt Spl */ 0, /* SrcGObjAt Mtrl */ 0, /* SrcGObjAt SPrm */ 0, - /* SrcGObjTg Se */ 0x23, + /* SrcGObjTg Se */ dCcD_SE_UNK23, /* SrcGObjTg HitMark */ 0, /* SrcGObjTg Spl */ 0, /* SrcGObjTg Mtrl */ 0, @@ -1813,7 +1813,7 @@ void daRd_c::createInit() { mD3C = 1; mD40 = 1; - mItemStealLeft = 5; + mStealItemLeft = 5; mEnemyFire.mpMcaMorf = mpMorf; mEnemyFire.mpActor = this; diff --git a/src/d/d_cc_uty.cpp b/src/d/d_cc_uty.cpp index ff04bff18..21e9bf406 100644 --- a/src/d/d_cc_uty.cpp +++ b/src/d/d_cc_uty.cpp @@ -4,39 +4,274 @@ // #include "d/d_cc_uty.h" -#include "dolphin/types.h" +#include "d/d_com_inf_game.h" +#include "d/actor/d_a_player.h" +#include "d/actor/d_a_bomb.h" +#include "d/actor/d_a_tsubo.h" +#include "d/actor/d_a_mt.h" +#include "d/d_procname.h" +#include "d/d_s_play.h" /* 800AE938-800AE9E8 .text cc_pl_cut_bit_get__Fv */ -void cc_pl_cut_bit_get() { - /* Nonmatching */ +int cc_pl_cut_bit_get() { + daPy_py_c* player = daPy_getPlayerActorClass(); + int r3 = 0; + if (player->getCutType() == 1) { + r3 = 0x01; + } else if (player->getCutType() == 2) { + r3 = 0x02; + } else if (player->getCutType() == 3) { + r3 = 0x04; + } else if (player->getCutType() == 4) { + r3 = 0x08; + } else if (player->getCutType() == 5) { + r3 = 0x10; + } else if (player->getCutType() == 6) { + r3 = 0x20; + } else if (player->getCutType() == 7) { + r3 = 0x40; + } else if (player->getCutType() == 8 || player->getCutType() == 9) { + r3 = 0x80; + } else if (player->getCutType() == 10) { + r3 = 0x100; + } + return r3; } /* 800AE9E8-800AEA60 .text at_se_get__FP8cCcD_Obj */ -void at_se_get(cCcD_Obj*) { - /* Nonmatching */ +u32 at_se_get(cCcD_Obj* obj) { + dCcD_GObjInf* gObjInf = dCcD_GetGObjInf(obj); + if (gObjInf->GetAtType() & (AT_TYPE_SKULL_HAMMER | AT_TYPE_STALFOS_MACE)) { + return JA_SE_LK_HAMMER_HIT; + } else if (gObjInf->GetAtSe() == dCcD_SE_UNK4) { + return JA_SE_LK_W_WEP_HIT; + } else if (gObjInf->GetAtSe() == dCcD_SE_UNK5) { + return JA_SE_LK_MS_WEP_HIT; + } else if (gObjInf->GetAtSe() == dCcD_SE_ARROW) { + return JA_SE_LK_ARROW_HIT; + } else if (gObjInf->GetAtSe() == dCcD_SE_HOOKSHOT) { + return JA_SE_LK_HS_SPIKE; + } else { + return JA_SE_LK_SW_HIT_S; + } } /* 800AEA60-800AEAD8 .text at_se_getC__FP8cCcD_Obj */ -void at_se_getC(cCcD_Obj*) { - /* Nonmatching */ +u32 at_se_getC(cCcD_Obj* obj) { + dCcD_GObjInf* gObjInf = dCcD_GetGObjInf(obj); + if (gObjInf->GetAtType() & (AT_TYPE_SKULL_HAMMER | AT_TYPE_STALFOS_MACE)) { + return JA_SE_LK_HAMMER_HIT; + } else if (gObjInf->GetAtSe() == dCcD_SE_UNK4) { + return JA_SE_LK_W_WEP_CRT_HIT; + } else if (gObjInf->GetAtSe() == dCcD_SE_UNK5) { + return JA_SE_LK_MS_WEP_CRT_HIT; + } else if (gObjInf->GetAtSe() == dCcD_SE_ARROW) { + return JA_SE_LK_ARROW_HIT; + } else if (gObjInf->GetAtSe() == dCcD_SE_HOOKSHOT) { + return JA_SE_LK_HS_SPIKE; + } else { + return JA_SE_LK_SW_CRT_HIT; + } } /* 800AEAD8-800AEB50 .text def_se_set__FP10fopAc_ac_cP8cCcD_ObjUl */ -void def_se_set(fopAc_ac_c*, cCcD_Obj*, unsigned long) { - /* Nonmatching */ +void def_se_set(fopAc_ac_c* actor, cCcD_Obj* obj, unsigned long r5) { + fopAcM_seStart(actor, at_se_get(obj), r5); } /* 800AEB50-800AEBCC .text def_se_set_p__FP10fopAc_ac_cP4cXyzP8cCcD_ObjUl */ -void def_se_set_p(fopAc_ac_c*, cXyz*, cCcD_Obj*, unsigned long) { - /* Nonmatching */ +void def_se_set_p(fopAc_ac_c* actor, cXyz* sePos, cCcD_Obj* obj, unsigned long r6) { + mDoAud_seStart(at_se_get(obj), sePos, r6, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } /* 800AEBCC-800AEEF8 .text at_power_check__FP8CcAtInfo */ -void at_power_check(CcAtInfo*) { - /* Nonmatching */ +fopAc_ac_c* at_power_check(CcAtInfo* atInfo) { + daPy_py_c* player = daPy_getPlayerActorClass(); + if (atInfo->mpObj == NULL) { + return NULL; + } + fopAc_ac_c* r0; + if (atInfo->mpObj->GetStts() == NULL) { + r0 = NULL; + } else { + r0 = atInfo->mpObj->GetStts()->GetAc(); + } + atInfo->mpActor = r0; + atInfo->mResultingAttackType = 0xC; + atInfo->mDamage = 0; + + if (atInfo->mpObj->GetAtType() & AT_TYPE_WATER) { + atInfo->mResultingAttackType = 0x4; + return atInfo->mpActor; + } else if (atInfo->mpObj->GetAtType() & AT_TYPE_WIND) { + atInfo->mResultingAttackType = 0x8; + return atInfo->mpActor; + } else if (atInfo->mpObj->GetAtType() & AT_TYPE_UNK20000) { + atInfo->mResultingAttackType = 0x5; + return atInfo->mpActor; + } else if (atInfo->mpObj->GetAtType() & (AT_TYPE_FIRE | AT_TYPE_FIRE_ARROW)) { + atInfo->mResultingAttackType = 0x5; + } + + if (atInfo->mpActor) { + atInfo->mDamage = atInfo->mpObj->GetAtAtp(); + + if (fopAcM_GetName(atInfo->mpActor) == PROC_PLAYER) { + if (atInfo->mpObj->GetAtType() & AT_TYPE_SKULL_HAMMER) { + atInfo->mResultingAttackType = 0x9; + } else { + atInfo->mResultingAttackType = 0x1; + atInfo->mPlCutBit = cc_pl_cut_bit_get(); + + if (player->getCutCount() == 3) { + atInfo->mHitSoundId = 1; + } else if (player->getCutCount() == 4) { + atInfo->mHitSoundId = 4; + } else if (player->getCutType() == 0xA) { + atInfo->mHitSoundId = 2; + } else if (player->getCutType() == 0x5 || player->getCutType() == 0xF || player->getCutType() == 0x10) { + atInfo->mHitSoundId = 3; + } else { + atInfo->mHitSoundId = 0; + } + } + } else if (fopAcM_GetName(atInfo->mpActor) == PROC_BOMB) { + daBomb_c* bomb = (daBomb_c*)atInfo->mpActor; + if (bomb->chk_state(daBomb_c::STATE_8)) { + atInfo->mResultingAttackType = 0xD; + } else { + atInfo->mResultingAttackType = 0x2; + } + atInfo->mPlCutBit = 0x200; + } else if (fopAcM_GetName(atInfo->mpActor) == PROC_Bomb2) { + atInfo->mResultingAttackType = 0x2; + atInfo->mPlCutBit = 0x200; + } else if (fopAcM_GetName(atInfo->mpActor) == PROC_HIMO2) { + atInfo->mResultingAttackType = 0xE; + atInfo->mPlCutBit = 0x400; + } else if (fopAcM_GetName(atInfo->mpActor) == PROC_BOOMERANG) { + atInfo->mResultingAttackType = 0xA; + atInfo->mPlCutBit = 0x800; + } else if (fopAcM_GetName(atInfo->mpActor) == PROC_ARROW) { + atInfo->mPlCutBit = 0x1000; + } else if (fopAcM_GetName(atInfo->mpActor) == PROC_BDK) { + atInfo->mResultingAttackType = 0xB; + } else if (fopAcM_GetName(atInfo->mpActor) == PROC_TSUBO) { + daTsubo::Act_c* tsubo = (daTsubo::Act_c*)atInfo->mpActor; + if (tsubo->prm_get_type() == daTsubo::Act_c::TYPE_WATER_JUG) { + atInfo->mResultingAttackType = 0x4; + } else { + atInfo->mResultingAttackType = 0x3; + } + } else if (fopAcM_GetName(atInfo->mpActor) == PROC_MO2) { + atInfo->mResultingAttackType = 0x7; + if (atInfo->mDamage > 2) { + atInfo->mDamage = 2; + } + } else if (fopAcM_GetName(atInfo->mpActor) == PROC_MT) { + atInfo->mResultingAttackType = 0x6; + atInfo->mDamage = 4; + } + } + + atInfo->mbDead = 0; + if (fopAcM_GetName(atInfo->mpActor) == PROC_PLAYER) { + dCcD_GObjInf* gObjInf = dCcD_GetGObjInf(atInfo->mpObj); + if (gObjInf->GetAtSpl() == 1) { + atInfo->mbDead = 1; + } + } else if (atInfo->mDamage >= 2) { + atInfo->mbDead = 1; + } + + return atInfo->mpActor; } /* 800AEEF8-800AF368 .text cc_at_check__FP10fopAc_ac_cP8CcAtInfo */ -void cc_at_check(fopAc_ac_c*, CcAtInfo*) { - /* Nonmatching */ +fopAc_ac_c* cc_at_check(fopAc_ac_c* r30, CcAtInfo* atInfo) { + atInfo->mHitSoundId = 0; + atInfo->mpActor = at_power_check(atInfo); + + s8 r28; + + if (atInfo->mpActor) { + mDoAud_onEnemyDamage(); + + f32 f2, f0; + if (atInfo->mpActor->speed.abs() > 50.0f) { + f2 = atInfo->mpActor->speed.x; + f0 = atInfo->mpActor->speed.z; + } else { + f2 = r30->current.pos.x - atInfo->mpActor->current.pos.x; + f0 = r30->current.pos.z - atInfo->mpActor->current.pos.z; + } + atInfo->m0E = cM_atan2s(-f2, -f0); + + if (atInfo->mpObj->GetAtType() & AT_TYPE_HOOKSHOT) { + if (fopAcM_checkStatus(r30, fopAcStts_UNK80000_e | fopAcStts_HOOK_CARRY_e | fopAcStts_UNK200000_e)) { + atInfo->mDamage = 0; + } + } + + if (fopAcM_GetName(atInfo->mpActor) == PROC_HIMO2 && r30->mStealItemLeft != 0) { + r30->mStealItemLeft--; + fopAcM_createStealItem(&r30->current.pos, r30->mItemTableIdx, r30->current.roomNo, NULL, r30->mStealItemBitNo); + r30->mStealItemBitNo++; + atInfo->mDamage = 0; + } + + if ((s8)atInfo->mDamage > 0) { + r30->mHealth -= atInfo->mDamage; + } + + if (r30->mHealth <= 0) { + atInfo->mbDead = 1; + + fopAcM_seStart(r30, JA_SE_LK_LAST_HIT, 0); + + r28 = 6 + g_regHIO.mChild->mShortRegs[7]; + + if (atInfo->pParticlePos) { + dComIfGp_particle_set(0x10, atInfo->pParticlePos); + cXyz scale; + scale.x = scale.y = scale.z = 2.0f; + csXyz angle; + angle.x = angle.z = 0; + angle.y = fopAcM_searchPlayerAngleY(r30); + dComIfGp_particle_set(dPa_name::ID_COMMON_NORMAL_HIT, atInfo->pParticlePos, &angle, &scale); + } + } else { + u32 r29 = fopAcM_GetName(r30) == PROC_ST ? 0x33 : 0x20; + if (atInfo->mbDead) { + fopAcM_seStart(r30, at_se_getC(atInfo->mpObj), r29); + if (atInfo->mResultingAttackType == 9) { + r28 = 6; + } else { + r28 = 4 + g_regHIO.mChild->mShortRegs[6]; + } + } else { + if (fopAcM_GetName(r30) == PROC_MT) { + mt_class* mt = (mt_class*)r30; + if (mt->m454 == 2) { + fopAcM_seStart(r30, JA_SE_OBJ_MG_BALL_DMG, 0); + } else { + fopAcM_seStart(r30, at_se_get(atInfo->mpObj), r29); + } + } else { + fopAcM_seStart(r30, at_se_get(atInfo->mpObj), r29); + } + r28 = 1 + g_regHIO.mChild->mShortRegs[5]; + } + } + + if (atInfo->mResultingAttackType == 1) { + dScnPly_ply_c::setPauseTimer(r28); + } + + if (atInfo->mDamage != 0) { + mDoAud_bgmHitSound(atInfo->mHitSoundId); + } + } + + return atInfo->mpActor; } diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index dac2f37ba..02a23171f 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -1253,7 +1253,7 @@ BOOL light_at_hit_check(cXyz* pPos) { BOOL ret = FALSE; fopAc_ac_c * pActor; u32 res = dComIfG_Ccsp()->ChkMass(pPos, &pActor, &hitInfo); - if (((res & 1) != 0) && (hitInfo.GetAtHitObj()->GetAtType() & AT_TYPE_LIGHT) != 0) + if (((res & 1) != 0) && (hitInfo.GetAtHitObj()->GetAtType() & AT_TYPE_LIGHT)) ret = TRUE; return ret; } diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index c03c2328e..4b949b92c 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -865,7 +865,7 @@ s32 fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo, int r if (tableIdx == RECOVER_FAIRY) { // Bug: This condition never gets triggered. They meant to check if (itemNo == RECOVER_FAIRY) so - // that the 3x fairies drop table (table 0x14) spawns them in a triangle. But nstead they check if + // that the 3x fairies drop table (table 0x14) spawns them in a triangle. But instead they check if // the table index is equal to 0x16/RECOVER_FAIRY, which will never be true. pos += fairy_offset_tbl[i]; angle.y = cM_rndF((f32)0x7FFE);