From e1c7aa6d560d34c381939770c2de7dc7b3737c35 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:17:46 +0200 Subject: [PATCH 01/30] daPy_mtxPosFollowEcallBack_c::execute matching --- src/d/actor/d_a_player_particle.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index ac42d70cf..cd02cc53d 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -254,8 +254,13 @@ void daPy_mtxPosFollowEcallBack_c::makeEmitterColor(u16 particleID, MtxP mtx, co } /* 8012A0E0-8012A160 .text execute__28daPy_mtxPosFollowEcallBack_cFP14JPABaseEmitter */ -void daPy_mtxPosFollowEcallBack_c::execute(JPABaseEmitter*) { - /* Nonmatching */ +void daPy_mtxPosFollowEcallBack_c::execute(JPABaseEmitter* emitter) { + mDoMtx_stack_c::transS(mpMtx[0][3], mpMtx[1][3], mpMtx[2][3]); + if (mpAngle != NULL) { + mDoMtx_stack_c::YrotM(mpAngle->y); + } + + emitter->setGlobalRTMatrix(mDoMtx_stack_c::get()); } s16 daPy_dmEcallBack_c::m_timer = 0; From 546b782a9878e63e728419db47f30cbef1d27c01 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:33:18 +0200 Subject: [PATCH 02/30] daPy_waterDropEcallBack_c::end matching --- src/d/actor/d_a_player_particle.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index cd02cc53d..4d1b86bd5 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -244,7 +244,13 @@ void daPy_waterDropEcallBack_c::setup(JPABaseEmitter* emitter, const cXyz* pos, /* 8012A058-8012A0B4 .text end__25daPy_waterDropEcallBack_cFv */ void daPy_waterDropEcallBack_c::end() { - /* Nonmatching */ + if (mpEmitter != NULL) { + mpEmitter->quitImmortalEmitter(); + mpEmitter->deleteAllParticle(); + mpEmitter->setParticleCallBackPtr(NULL); + + daPy_followEcallBack_c::end(); + } } /* 8012A0B4-8012A0E0 .text makeEmitterColor__28daPy_mtxPosFollowEcallBack_cFUsPA4_fPC4cXyzPC5csXyzPC8_GXColorPC8_GXColor */ From fedabd8e3f70eb0ecf5e312deafa84032acf2c58 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:56:57 +0200 Subject: [PATCH 03/30] daPy_dmEcallBack_c::execute matching --- src/d/actor/d_a_player_particle.inc | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 4d1b86bd5..323e4fbc3 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -273,8 +273,29 @@ s16 daPy_dmEcallBack_c::m_timer = 0; u16 daPy_dmEcallBack_c::m_type = 3; /* 8012A160-8012A288 .text execute__18daPy_dmEcallBack_cFP14JPABaseEmitter */ -void daPy_dmEcallBack_c::execute(JPABaseEmitter*) { - /* Nonmatching */ +void daPy_dmEcallBack_c::execute(JPABaseEmitter* emitter) { + if (m_type == 0) { + cXy v; + v.x = emitter->mGlobalTranslation.x; + v.y = emitter->mGlobalTranslation.z; + + emitter->setGlobalTranslation(mpMtx[0][3], mpMtx[1][3], mpMtx[2][3]); + + v.x = (mpMtx[0][3] - v.x) * -0.05f; + v.y = (mpMtx[2][3] - v.y) * -0.05f; + f32 sq = v.x * v.x + v.y * v.y; + + if (sq > 1.0f) { + f32 distFrac = 1.0f / sqrtf(sq); + + v.x *= distFrac; + v.y *= distFrac; + } + + emitter->setDirection(JGeometry::TVec3(v.x, 0.6f, v.y)); + } else { + emitter->setGlobalRTMatrix(mpMtx); + } } /* 8012A288-8012A8D8 .text setAuraEffect__9daPy_lk_cFv */ From aebd7773312dfc7d34ab7977a0af0b64c1b554cf Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:11:39 +0200 Subject: [PATCH 04/30] daPy_fanSwingEcallBack_c::execute matching --- src/d/actor/d_a_player_particle.inc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 323e4fbc3..81370fa2b 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -193,8 +193,22 @@ void daPy_swBlur_c::draw() { } /* 80129DD0-80129E9C .text execute__24daPy_fanSwingEcallBack_cFP14JPABaseEmitter */ -void daPy_fanSwingEcallBack_c::execute(JPABaseEmitter*) { - /* Nonmatching */ +void daPy_fanSwingEcallBack_c::execute(JPABaseEmitter* emitter) { + if (emitter->isEnableDeleteEmitter()) { + emitter->quitImmortalEmitter(); + emitter->setEmitterCallBackPtr(NULL); + mpEmitter = NULL; + } else if (mAlphaOutFlg != FALSE) { + s16 alpha = emitter->getGlobalAlpha(); + cLib_chaseS(&alpha, 0, 50); + emitter->setGlobalAlpha(alpha); + + if (alpha == 0) { + emitter->quitImmortalEmitter(); + emitter->setEmitterCallBackPtr(NULL); + mpEmitter = NULL; + } + } } /* 80129E9C-80129F48 .text execute__25daPy_waterDropPcallBack_cFP14JPABaseEmitterP15JPABaseParticle */ From 990a56e883d8d7840bbfec54f5f883afebab37b5 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sun, 21 Jul 2024 12:04:53 +0200 Subject: [PATCH 05/30] daPy_waterDropPcallBack_c::execute matching --- include/JSystem/JParticle/JPAParticle.h | 4 ++-- include/d/actor/d_a_player_main.h | 4 ++-- src/d/actor/d_a_player_particle.inc | 18 ++++++++++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/JSystem/JParticle/JPAParticle.h b/include/JSystem/JParticle/JPAParticle.h index 709d0a558..5f450e169 100644 --- a/include/JSystem/JParticle/JPAParticle.h +++ b/include/JSystem/JParticle/JPAParticle.h @@ -59,7 +59,7 @@ class JPABaseParticle { void getHeight() {} void getLifeTime() const {} void getLocalPosition(JGeometry::TVec3&) const {} - void getOffsetPosition(JGeometry::TVec3&) const {} + void getOffsetPosition(JGeometry::TVec3& out) const { out.set(mPosition); } void getVelVec(JGeometry::TVec3&) const {} void getWidth() {} void setDeleteParticleFlag() {} @@ -108,4 +108,4 @@ class JPAParticleCallBack { virtual void draw(JPABaseEmitter*, JPABaseParticle*); }; -#endif /* JPAPARTICLE_H */ \ No newline at end of file +#endif /* JPAPARTICLE_H */ diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 87c0e4815..565bf52ad 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -108,8 +108,8 @@ class daPy_waterDropPcallBack_c : public JPACallBackBase2 ptclPos; + ptcl->getOffsetPosition(ptclPos); + + cXyz pos(ptclPos.x, ptclPos.y + 25.0f, ptclPos.z); + mGndChk.SetPos(&pos); + + pos.y = dComIfG_Bgsp()->GroundCross(&mGndChk); + + if (pos.y > ptclPos.y) { + fopKyM_create(PROC_WATER_MARK, 1, &pos); + } + } } /* 80129F48-80129F98 .text execute__22daPy_followEcallBack_cFP14JPABaseEmitter */ From 3fdf0a20fe975ea71e1f66872beeba508292704b Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:04:23 +0200 Subject: [PATCH 06/30] daPy_sightPacket_c::draw matching --- include/d/actor/d_a_player_main.h | 9 +++-- src/d/actor/d_a_player_main.cpp | 23 ----------- src/d/actor/d_a_player_particle.inc | 62 ++++++++++++++++++++++++++++- 3 files changed, 66 insertions(+), 28 deletions(-) diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 565bf52ad..1c1b70e25 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -40,19 +40,20 @@ class daPy_sightPacket_c : public dDlst_base_c { void onLockFlg() { mLockFlag = true; } void offLockFlg() { mLockFlag = false; } void setPos(const cXyz* i_pos) { mPos = *i_pos; } - void setSightTex(void* sightTex) { mSightTex = sightTex; } + void setSightTex(void* sightTex) { mpSightTex = sightTex; } void setLockTex(void* lockTex) { mpLockTex = lockTex; } void setImage(ResTIMG* image) { mpImg = image; } private: /* 0x04 */ bool mDrawFlag; /* 0x05 */ bool mLockFlag; - /* 0x06 */ u8 field_0x6[2]; + /* 0x06 */ u8 field_0x6; + /* 0x07 */ u8 mLockAlpha; /* 0x08 */ cXyz mPos; - /* 0x14 */ Mtx field_0x14; + /* 0x14 */ Mtx mMtx; /* 0x44 */ ResTIMG* mpImg; /* 0x48 */ void* mpLockTex; - /* 0x4C */ void* mSightTex; + /* 0x4C */ void* mpSightTex; }; class daPy_actorKeep_c { diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 0fc4b36d9..5dfdf1ff5 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -39,29 +39,6 @@ JGeometry::TVec3 l_hammer_splash_particle_scale(0.67f, 0.67f, 0.67f); #include "d/actor/d_a_player_HIO.inc" -static u8 l_sightDL[] ALIGN_DECL(32) = { - 0x10, 0x00, 0x00, 0x10, 0x40, 0xFF, 0xFF, 0x42, 0x80, 0x08, 0x30, 0x3C, 0xF3, 0xCF, 0x00, - 0x10, 0x00, 0x00, 0x10, 0x18, 0x3C, 0xF3, 0xCF, 0x00, - 0x61, 0x28, 0x38, 0x03, 0xC0, - 0x61, 0xC0, 0x08, 0x42, 0x8F, - 0x61, 0xC1, 0x08, 0xE6, 0x70, - 0x61, 0x43, 0x00, 0x00, 0x01, - 0x61, 0x40, 0x00, 0x00, 0x06, - 0x61, 0x41, 0x00, 0x04, 0xAD, - 0x61, 0xF3, 0x64, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x10, 0x3F, 0x00, 0x00, 0x00, 0x01, - 0x10, 0x00, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x00, - 0x61, 0x00, 0x00, 0x00, 0x01, - 0x98, 0x00, 0x04, 0x01, 0x01, 0x00, 0x01, - 0x01, 0xFF, 0x01, 0x00, 0x00, 0x01, 0x01, 0xFF, 0x00, 0x01, 0x00, 0xFF, 0xFF, - - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, -}; - static void dummydatafunc(f32* temp, f64* temp2) { // temporary hack to improve diffs until sdata2 offsets are figured out *temp = 2.0f; diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index e2561b7d2..48b95b254 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -15,6 +15,29 @@ #include "d/actor/d_a_sea.h" #include "f_op/f_op_kankyo_mng.h" +static u8 l_sightDL[] ALIGN_DECL(32) = { + 0x10, 0x00, 0x00, 0x10, 0x40, 0xFF, 0xFF, 0x42, 0x80, 0x08, 0x30, 0x3C, 0xF3, 0xCF, 0x00, + 0x10, 0x00, 0x00, 0x10, 0x18, 0x3C, 0xF3, 0xCF, 0x00, + 0x61, 0x28, 0x38, 0x03, 0xC0, + 0x61, 0xC0, 0x08, 0x42, 0x8F, + 0x61, 0xC1, 0x08, 0xE6, 0x70, + 0x61, 0x43, 0x00, 0x00, 0x01, + 0x61, 0x40, 0x00, 0x00, 0x06, + 0x61, 0x41, 0x00, 0x04, 0xAD, + 0x61, 0xF3, 0x64, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x10, 0x3F, 0x00, 0x00, 0x00, 0x01, + 0x10, 0x00, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x00, 0x00, 0x00, 0x01, + 0x98, 0x00, 0x04, 0x01, 0x01, 0x00, 0x01, + 0x01, 0xFF, 0x01, 0x00, 0x00, 0x01, 0x01, 0xFF, 0x00, 0x01, 0x00, 0xFF, 0xFF, + + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, +}; + /* 8012901C-80129034 .text setup__24daPy_swimTailEcallBack_cFP14JPABaseEmitterPC4cXyzPC5csXyzSc */ void daPy_swimTailEcallBack_c::setup(JPABaseEmitter* emitter, const cXyz* pos, const csXyz* angle, s8) { mpEmitter = emitter; @@ -108,7 +131,44 @@ void daPy_swimTailEcallBack_c::draw(JPABaseEmitter*) { /* 80129348-8012952C .text draw__18daPy_sightPacket_cFv */ void daPy_sightPacket_c::draw() { - /* Nonmatching */ + j3dSys.reinitGX(); + GXSetNumIndStages(0); + + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_S8, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_U8, 0); + + GXTexObj texObj; + GXColor color; + if (mLockFlag) { + GXInitTexObj(&texObj, mpLockTex, mpImg->width, mpImg->height, (GXTexFmt)mpImg->format, (GXTexWrapMode)mpImg->wrapS, (GXTexWrapMode)mpImg->wrapT, (mpImg->mipmapCount > 1) ? GX_TRUE : GX_FALSE); + + color.r = 0xFF; + color.g = 0xFF; + color.b = 0x32; + color.a = mLockAlpha; + GXSetTevColor(GX_TEVREG0, color); + GXSetTevColor(GX_TEVREG1, color); + } else { + GXInitTexObj(&texObj, mpSightTex, 0x80, 0x80, GX_TF_I4, GX_CLAMP, GX_CLAMP, GX_FALSE); + + color.r = 0xFF; + color.g = 0x00; + color.b = 0x00; + color.a = 0xFF; + GXSetTevColor(GX_TEVREG0, color); + GXSetTevColor(GX_TEVREG1, color); + } + + GXInitTexObjLOD(&texObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE, GX_ANISO_1); + GXLoadTexObj(&texObj, GX_TEXMAP0); + GXLoadPosMtxImm(mMtx, GX_PNMTX0); + GXSetCurrentMtx(GX_PNMTX0); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL); + GXCallDisplayList(&l_sightDL, sizeof(l_sightDL) - 0x09); + J3DShape::resetVcdVatCache(); } /* 8012952C-801296FC .text setSight__18daPy_sightPacket_cFv */ From 1aea04708bbe814df97a9c6589f670330b7883ab Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:34:20 +0200 Subject: [PATCH 07/30] daPy_sightPacket_c::setSight matching --- src/d/actor/d_a_player_particle.inc | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 48b95b254..30620013e 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -14,6 +14,8 @@ #include "d/d_procname.h" #include "d/actor/d_a_sea.h" #include "f_op/f_op_kankyo_mng.h" +#include "m_Do/m_Do_lib.h" +#include "SSystem/SComponent/c_math.h" static u8 l_sightDL[] ALIGN_DECL(32) = { 0x10, 0x00, 0x00, 0x10, 0x40, 0xFF, 0xFF, 0x42, 0x80, 0x08, 0x30, 0x3C, 0xF3, 0xCF, 0x00, @@ -173,7 +175,32 @@ void daPy_sightPacket_c::draw() { /* 8012952C-801296FC .text setSight__18daPy_sightPacket_cFv */ void daPy_sightPacket_c::setSight() { - /* Nonmatching */ + cXyz proj; + mDoLib_project(&mPos, &proj); + mDoMtx_stack_c::transS(proj); + + if (mLockFlag) { + f32 var_f2; + f32 var_f31; + if (field_0x6 < 13) { + var_f2 = 1.0f - ((s16)field_0x6 / 13.0f); + var_f31 = -var_f2; + } else { + var_f2 = (field_0x6 - 13) / 13.0f; + var_f31 = var_f2; + } + + mLockAlpha = 150.0f + (30.0f * var_f2); + f32 temp_f3 = 0.65f + (0.35f * var_f2); + + mDoMtx_stack_c::scaleM(temp_f3 * mpImg->width, temp_f3 * mpImg->height, temp_f3); + mDoMtx_stack_c::ZrotM(32768.0f * cM_ssin(16384.0f * var_f31)); + } else { + mDoMtx_stack_c::scaleM(10.0f, 10.0f, 10.0f); + } + + mDoMtx_copy(mDoMtx_stack_c::get(), mMtx); + dComIfGd_set2DXlu(this); } /* 801296FC-801297F4 .text initSwBlur__13daPy_swBlur_cFPA4_fifi */ From 229dc65f672860e5d313b4315bfdbb05b002725c Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:39:44 +0200 Subject: [PATCH 08/30] daPy_swBlur_c::initSwBlur matching --- include/d/actor/d_a_player_main.h | 4 ++-- src/d/actor/d_a_player_particle.inc | 17 +++++++++++++++-- src/d/actor/d_a_player_sword.inc | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 1c1b70e25..e03dae638 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -251,8 +251,8 @@ class daPy_swBlur_c : public J3DPacket { /* 0x014 */ int field_0x014; /* 0x018 */ int field_0x018; /* 0x01C */ int mBlurColorType; - /* 0x020 */ f32 field_0x020; - /* 0x024 */ void* mpPosBuffer; + /* 0x020 */ f32 mBlurTopRate; + /* 0x024 */ Vec* mpPosBuffer; // Pointer to tuple array? (could possibly use typedef for readability) /* 0x028 */ cXyz field_0x028; /* 0x034 */ cXyz field_0x034[60]; /* 0x304 */ cXyz field_0x304[60]; diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 30620013e..5677e9b17 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -204,8 +204,21 @@ void daPy_sightPacket_c::setSight() { } /* 801296FC-801297F4 .text initSwBlur__13daPy_swBlur_cFPA4_fifi */ -void daPy_swBlur_c::initSwBlur(MtxP, int, f32, int) { - /* Nonmatching */ +void daPy_swBlur_c::initSwBlur(MtxP mtx, int idx, f32 blurTopRate, int blurColorType) { + int i = idx * 2; + + mBlurTopRate = blurTopRate; + mBlurColorType = blurColorType; + + mDoMtx_multVec(mtx, mpPosBuffer + i, &field_0x034[0]); + mDoMtx_multVec(mtx, mpPosBuffer + i + 1, &field_0x304[0]); + + field_0x034[0] += (field_0x034[0] - field_0x304[0]) * mBlurTopRate; + field_0x034[1] = field_0x034[0]; + field_0x304[1] = field_0x304[0]; + field_0x014 = 0; + field_0x018 = idx; + field_0x028.set(mtx[0][3], mtx[1][3], mtx[2][3]); } /* 801297F4-80129A78 .text copySwBlur__13daPy_swBlur_cFPA4_fi */ diff --git a/src/d/actor/d_a_player_sword.inc b/src/d/actor/d_a_player_sword.inc index 9df54957b..7220c98d5 100644 --- a/src/d/actor/d_a_player_sword.inc +++ b/src/d/actor/d_a_player_sword.inc @@ -71,7 +71,7 @@ void daPy_lk_c::setSwordModel(BOOL r28) { modelData->entryTexMtxAnimator(mpEquipItemBtk); } - mSwBlur.mpPosBuffer = new(0x20) u8[0x4800]; + mSwBlur.mpPosBuffer = new(0x20) Vec[2 * 0x300]; modelData = initModel(&mpSwordModel1, model_tbl.glowModel, 0x13000222); buffer = new(0x20) u8[0x400]; From 99bb3f644f2b8d36d43f66b8866020e3ce99c07d Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Tue, 23 Jul 2024 20:39:31 +0200 Subject: [PATCH 09/30] daPy_swBlur_c matching --- include/d/actor/d_a_player_main.h | 6 +++ src/d/actor/d_a_player_particle.inc | 58 +++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index e03dae638..66ffc3a96 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -241,6 +241,12 @@ class daPy_matAnm_c : public J3DMaterialAnm { }; // Size: 0x7C class daPy_swBlur_c : public J3DPacket { +public: + enum BlurColorType { + NORMAL_SLASH_BLUR, + ELIXIR_SOUP_SLASH_BLUR, + PARRYING_SLASH_BLUR, + }; public: void initSwBlur(MtxP, int, f32, int); void copySwBlur(MtxP, int); diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 5677e9b17..1667f70bb 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -222,8 +222,58 @@ void daPy_swBlur_c::initSwBlur(MtxP mtx, int idx, f32 blurTopRate, int blurColor } /* 801297F4-80129A78 .text copySwBlur__13daPy_swBlur_cFPA4_fi */ -void daPy_swBlur_c::copySwBlur(MtxP, int) { - /* Nonmatching */ +void daPy_swBlur_c::copySwBlur(MtxP mtx, int param_2) { + int var_r31 = param_2 - field_0x018; + field_0x018 = param_2; + + int var_r30; + if (var_r31 > 0) { + var_r30 = -2; + + if (var_r31 > 60) { + var_r31 = 60; + } + } else if (var_r31 < 0) { + var_r30 = 2; + + if (var_r31 < -60) { + var_r31 = 60; + } else { + var_r31 = -var_r31; + } + } else { + var_r31 = 10; + var_r30 = 0; + } + + for (int i = 59 - var_r31; i >= 0; i--) { + field_0x034[i + var_r31] = field_0x034[i]; + field_0x304[i + var_r31] = field_0x304[i]; + } + + // Very obvious fakematch + f32 var_f31 = 0.0f; + f32 frac = 1.0f / var_r31; + int i; + int buffIdx = field_0x018 * 2; + cXyz sp50(mtx[0][3], mtx[1][3], mtx[2][3]); + cXyz sp38 = field_0x028 - sp50; + field_0x028 = sp50; + for (i = 0; i < var_r31 && buffIdx >= 0; i++) { + mDoMtx_multVec(mtx, mpPosBuffer + buffIdx, &field_0x034[i]); + mDoMtx_multVec(mtx, mpPosBuffer + buffIdx + 1, &field_0x304[i]); + + field_0x034[i] += (field_0x034[i] - field_0x304[i]) * mBlurTopRate; + field_0x034[i] += sp38 * var_f31; + field_0x304[i] += sp38 * var_f31; + var_f31 += frac; + buffIdx += var_r30; + } + + field_0x014 += var_r31; + if (field_0x014 >= 59) { + field_0x014 = 58; + } } /* 80129A78-80129DD0 .text draw__13daPy_swBlur_cFv */ @@ -246,11 +296,11 @@ void daPy_swBlur_c::draw() { GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); GXSetNumChans(0); - if (mBlurColorType == 0) { + if (mBlurColorType == NORMAL_SLASH_BLUR) { // Normal color. static GXColor n_color = {0xFF, 0xFF, 0xFF, 0x96}; GXSetTevColor(GX_TEVREG0, n_color); - } else if (mBlurColorType == 1) { + } else if (mBlurColorType == ELIXIR_SOUP_SLASH_BLUR) { // Elixir Soup color. static GXColor y_color = {0xFF, 0xFF, 0x7B, 0x96}; GXSetTevColor(GX_TEVREG0, y_color); From c4b5850429d06e09686fb14fc73abdc1ba2ac3fd Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 24 Jul 2024 01:25:53 +0200 Subject: [PATCH 10/30] daPy_lk_c::setWaterDrop matching --- include/d/d_kankyo.h | 1 + src/d/actor/d_a_player_particle.inc | 46 ++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h index fc67e13ae..ff053b69c 100644 --- a/include/d/d_kankyo.h +++ b/include/d/d_kankyo.h @@ -455,5 +455,6 @@ u8 dKy_get_schbit(); int dKy_rain_check(); void dKy_setLight_mine(dKy_tevstr_c* pTevStr); BOOL dKy_daynighttact_stop_chk(); +BOOL dKyr_player_overhead_bg_chk(); #endif /* D_KANKYO_D_KANKYO_H */ diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 1667f70bb..d7f48f97b 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -558,7 +558,51 @@ void daPy_lk_c::setSwimWaterDrop(daPy_waterDropEcallBack_c*) { /* 8012C45C-8012C620 .text setWaterDrop__9daPy_lk_cFv */ void daPy_lk_c::setWaterDrop() { - /* Nonmatching */ + MtxP mtx = mpCLModel->getAnmMtx(0x0E); + cXyz tmp; + tmp.x = mtx[0][3]; + tmp.y = mtx[1][3]; + tmp.z = mtx[2][3]; + m334C.field_0x08 = tmp; + + mtx = mpCLModel->getAnmMtx(0x02); + tmp.x = mtx[0][3]; + tmp.y = mtx[1][3]; + tmp.z = mtx[2][3]; + m336C.field_0x08 = tmp; + + if (mModeFlg & ModeFlg_00000001) { + daPy_waterDropEcallBack_c::m_pcallback.field_0x4 = TRUE; + } else { + daPy_waterDropEcallBack_c::m_pcallback.field_0x4 = FALSE; + } + + if (mDmEcallBack->m_type == 0) { + m334C.end(); + m336C.end(); + m3460[0].end(); + m3460[1].end(); + return; + } + + if (dKyr_player_overhead_bg_chk() && dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) != dStageType_MISC_e && mCurProc != PROC_KI && mAcch.m_roof_y == 1e9f) { + if (m3460[0].mpEmitter == NULL) { + m3460[0].makeEmitter(0x432, mpCLModel->getAnmMtx(0x0E), ¤t.pos, NULL); + } + + if (m3460[1].mpEmitter == NULL) { + m3460[1].makeEmitter(0x432, mpCLModel->getAnmMtx(0x02), ¤t.pos, NULL); + } + + m334C.end(); + m336C.end(); + return; + } + + m3460[0].end(); + m3460[1].end(); + setSwimWaterDrop(&m334C); + setSwimWaterDrop(&m336C); } /* 8012C620-8012C754 .text setDamageFlameEmitter__9daPy_lk_cFv */ From e1b5dda0fff5bd2de765e78082b9feb997464d3e Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 24 Jul 2024 01:56:57 +0200 Subject: [PATCH 11/30] daPy_lk_c::setFootMark matching --- src/d/actor/d_a_player_particle.inc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index d7f48f97b..fbcc6b014 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -526,8 +526,18 @@ void daPy_lk_c::setFootEffectType(int, cXyz*, int, int) { } /* 8012B8EC-8012B9DC .text setFootMark__9daPy_lk_cFP4cXyz */ -void daPy_lk_c::setFootMark(cXyz*) { - /* Nonmatching */ +void daPy_lk_c::setFootMark(cXyz* i_pos) { + cXyz pos(i_pos->x, i_pos->y + 5.0f, i_pos->z); + mGndChk.SetPos(&pos); + + pos.y = dComIfG_Bgsp()->GroundCross(&mGndChk); + if (pos.y != -1e9f && dComIfG_Bgsp()->GetAttributeCode(mGndChk) == dBgS_Attr_SAND_e) { + fopKyM_create(PROC_WATER_MARK, (shape_angle.y << 16) | 2, &pos, &scale, NULL); + } + + if (m336C.mpEmitter != NULL) { + fopKyM_create(PROC_WATER_MARK, shape_angle.y << 16, i_pos, &scale); + } } /* 8012B9DC-8012C128 .text setFootEffect__9daPy_lk_cFv */ From 9369ea7b44dc11501094e687ec766231fc0c0580 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:23:14 +0200 Subject: [PATCH 12/30] daPy_footEffect_c work --- include/d/actor/d_a_player_main.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 66ffc3a96..cc9c87ccb 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -79,10 +79,20 @@ class daPy_footEffect_c { dPa_smokeEcallBack* getSmokeCallBack() { return &mSmokeCb; } dPa_followEcallBack* getOtherCallBack() { return &mFollowCb; } - + + // Might be incorrect + void setID(s32 id) { mId = id; } + s32 getID() const { return mId; } + void setAngle(csXyz* angle) { mAngle = *angle; } + csXyz getAngle() { return mAngle; } + void setPos(const cXyz* pos) { mPos = *pos; } + cXyz getPos() { return mPos; } + /* 0x00 */ dPa_smokeEcallBack mSmokeCb; /* 0x20 */ dPa_followEcallBack mFollowCb; - /* 0x34 */ u8 field_0x34[0x4C - 0x34]; + /* 0x34 */ cXyz mPos; + /* 0x40 */ csXyz mAngle; + /* 0x48 */ s32 mId; }; class daPy_fanSwingEcallBack_c : public dPa_levelEcallBack { From 8d6ae6e87829ba2322b8d1e69690969424a48d97 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 24 Jul 2024 12:38:47 +0200 Subject: [PATCH 13/30] daPy_lk_c::resetFootEffect matching --- src/d/actor/d_a_player_particle.inc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index fbcc6b014..51970afba 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -547,7 +547,17 @@ void daPy_lk_c::setFootEffect() { /* 8012C128-8012C1A8 .text resetFootEffect__9daPy_lk_cFv */ void daPy_lk_c::resetFootEffect() { - /* Nonmatching */ + // Fakematch? + daPy_footEffect_c* pFootEffect = m31E8; + for (int idx = 0; idx < (s32)ARRAY_SIZE(m31E8); idx++) { + pFootEffect[0].getSmokeCallBack()->end(); + pFootEffect[0].getOtherCallBack()->end(); + pFootEffect[0].setID(-1); + + pFootEffect++; + } + + m34BE = 0; } /* 8012C1A8-8012C2A4 .text setSwimTail__9daPy_lk_cFv */ From 1016dc85635993d1167a963b04e87da9c1a63248 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:38:58 +0200 Subject: [PATCH 14/30] daPy_lk_c::setSwimTail matching --- include/d/actor/d_a_player_main.h | 6 +++++- src/d/actor/d_a_player_particle.inc | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index cc9c87ccb..c414d8292 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -138,12 +138,16 @@ class daPy_swimTailEcallBack_c : public dPa_levelEcallBack { field_0x20 = NULL; } + JPABaseEmitter* getEmitter() { return mpEmitter; } + cXyz& getPos() { return mPos; } + void setPos(cXyz& pos) { mPos = pos; } + /* 0x04 */ bool field_0x04; /* 0x05 */ bool field_0x05; /* 0x08 */ f32 field_0x08; /* 0x0C */ f32 field_0x0C; /* 0x10 */ f32 field_0x10; - /* 0x14 */ cXyz field_0x14; + /* 0x14 */ cXyz mPos; /* 0x20 */ const csXyz* field_0x20; /* 0x24 */ JPABaseEmitter* mpEmitter; }; // Size: 0x28 diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 51970afba..bcbd9ef09 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -93,7 +93,7 @@ void daPy_swimTailEcallBack_c::execute(JPABaseEmitter* emitter) { } if (field_0x20 != NULL) { - emitter->setGlobalTranslation(field_0x14.x, field_0x14.y, field_0x14.z); + emitter->setGlobalTranslation(mPos.x, mPos.y, mPos.z); JGeometry::TVec3 rot(0, 0, 0); rot.y = field_0x20->y; emitter->setGlobalRotation(rot); @@ -562,8 +562,16 @@ void daPy_lk_c::resetFootEffect() { /* 8012C1A8-8012C2A4 .text setSwimTail__9daPy_lk_cFv */ void daPy_lk_c::setSwimTail() { - /* Nonmatching */ static JGeometry::TVec3 tail_scale(1.0f, 1.0f, -1.0f); + + if (mSwimTailEcallBack[0].getEmitter() == NULL) { + dComIfGp_particle_setShipTail(0x3A, &mSwimTailEcallBack[0].getPos(), ¤t.angle, &scale, 0xFF, &mSwimTailEcallBack[0]); + mSwimTailEcallBack[0].field_0x05 = true; + } + + if (mSwimTailEcallBack[1].getEmitter() == NULL) { + dComIfGp_particle_setShipTail(0x3A, &mSwimTailEcallBack[1].getPos(), ¤t.angle, &scale, 0xFF, &mSwimTailEcallBack[1]); + } } /* 8012C2A4-8012C330 .text setCutWaterSplash__9daPy_lk_cFv */ From e048d1de52395af7341c371370f414a7f88351b5 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:05:46 +0200 Subject: [PATCH 15/30] daPy_lk_c::setCutWaterSplash matching --- include/d/actor/d_a_player_main.h | 4 ++++ src/d/actor/d_a_player_particle.inc | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index c414d8292..f85a9d0b3 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -160,6 +160,10 @@ class daPy_followEcallBack_c : public dPa_levelEcallBack { void setup(JPABaseEmitter*, const cXyz*, const csXyz*, s8); void end(); ~daPy_followEcallBack_c() {} + JPABaseEmitter* getEmitter() { return mpEmitter; } + void setPos(const cXyz* pos) { field_0x08 = *pos; } + cXyz& getPos() { return field_0x08; } + void setAngle(s16 x, s16 y, s16 z) { field_0x14.set(x, y, z); } /* 0x04 */ JPABaseEmitter* mpEmitter; /* 0x08 */ cXyz field_0x08; diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index bcbd9ef09..81c645aad 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -576,7 +576,15 @@ void daPy_lk_c::setSwimTail() { /* 8012C2A4-8012C330 .text setCutWaterSplash__9daPy_lk_cFv */ void daPy_lk_c::setCutWaterSplash() { - /* Nonmatching */ + if (m336C.getEmitter() != NULL) { + MtxP mtx = mpCLModel->getAnmMtx(4); + cXyz pos; + pos.x = mtx[0][3]; + pos.y = mtx[1][3]; + pos.z = mtx[2][3]; + + dComIfGp_particle_setP1(0x39, &pos); + } } /* 8012C330-8012C45C .text setSwimWaterDrop__9daPy_lk_cFP25daPy_waterDropEcallBack_c */ From 9af51d288701fcd23e03234d4901170093b9afad Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:22:28 +0200 Subject: [PATCH 16/30] daPy_lk_c::setDamageCurseEmitter matching --- src/d/actor/d_a_player_particle.inc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 81c645aad..8b98c642e 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -674,7 +674,19 @@ void daPy_lk_c::setDamageFlameEmitter() { /* 8012C754-8012C7F0 .text setDamageCurseEmitter__9daPy_lk_cFv */ void daPy_lk_c::setDamageCurseEmitter() { - /* Nonmatching */ + if (!daPy_dmEcallBack_c::checkCurse()) { + endDamageEmitter(); + + mDmEcallBack->makeEmitter(0x815B, mpCLModel->getAnmMtx(0x1E), ¤t.pos, NULL); + + if (checkUpperReadyThrowAnime()) { + resetActAnimeUpper(UPPER_MOVE2_e, -1.0f); + freeRopeItem(); + } + } + + cancelNoDamageMode(); + daPy_dmEcallBack_c::setCurse(200); } /* 8012C7F0-8012C880 .text setDamageElecEmitter__9daPy_lk_cFv */ From 74b3497fbb746c27017d901443bf0a2bc9dc5088 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:33:02 +0200 Subject: [PATCH 17/30] daPy_lk_c::setDamageElecEmitter matching --- src/d/actor/d_a_player_particle.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 8b98c642e..3e8c31edf 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -11,6 +11,7 @@ */ #include "d/actor/d_a_player_main.h" +#include "d/actor/d_a_player_HIO.h" #include "d/d_procname.h" #include "d/actor/d_a_sea.h" #include "f_op/f_op_kankyo_mng.h" @@ -691,7 +692,14 @@ void daPy_lk_c::setDamageCurseEmitter() { /* 8012C7F0-8012C880 .text setDamageElecEmitter__9daPy_lk_cFv */ void daPy_lk_c::setDamageElecEmitter() { - /* Nonmatching */ + if (!daPy_dmEcallBack_c::checkElec()) { + endDamageEmitter(); + + mDmEcallBack[0].makeEmitter(0x3ED, mpCLModel->getAnmMtx(4), ¤t.pos, NULL); + mDmEcallBack[1].makeEmitter(0x3EE, mpCLModel->getAnmMtx(4), ¤t.pos, NULL); + } + + daPy_dmEcallBack_c::setElec(daPy_HIO_elecDamage_c0::m.field_0x2); } /* 8012C880-8012C8F8 .text setDamageEmitter__9daPy_lk_cFv */ From c445f3cb69b6386c9c9e8d511cda8b01722232d6 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 26 Jul 2024 14:42:47 +0200 Subject: [PATCH 18/30] daPy_lk_c::setDamageEmitter matching --- src/d/actor/d_a_player_particle.inc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 3e8c31edf..502dcb5f7 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -704,7 +704,16 @@ void daPy_lk_c::setDamageElecEmitter() { /* 8012C880-8012C8F8 .text setDamageEmitter__9daPy_lk_cFv */ void daPy_lk_c::setDamageEmitter() { - /* Nonmatching */ + dCcD_GObjInf* tgHitGObj = mCyl.GetTgHitGObj(); + if (tgHitGObj != NULL) { + if (tgHitGObj->GetAtSpl() == 0x3) { + setDamageCurseEmitter(); + } else if (tgHitGObj->GetAtSpl() == 0xB) { + setDamageElecEmitter(); + } else if (tgHitGObj->ChkAtType(AT_TYPE_FIRE)) { + setDamageFlameEmitter(); + } + } } /* 8012C8F8-8012C9D8 .text endFlameDamageEmitter__9daPy_lk_cFv */ From 30da11835374f6209d9116338fc6a83bd817f672 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:05:06 +0200 Subject: [PATCH 19/30] daPy_lk_c::endFlameDamageEmitter matching --- src/d/actor/d_a_player_particle.inc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 502dcb5f7..e3874ba1a 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -718,7 +718,21 @@ void daPy_lk_c::setDamageEmitter() { /* 8012C8F8-8012C9D8 .text endFlameDamageEmitter__9daPy_lk_cFv */ void daPy_lk_c::endFlameDamageEmitter() { - /* Nonmatching */ + if (!daPy_dmEcallBack_c::checkFlame()) return; + + if (current.pos.y < m35D0 - 10.0f) { + for (int i = 0; i < (s32)ARRAY_SIZE(mDmEcallBack); i++) { + cXyz pos; + pos.x = mDmEcallBack[i].mpMtx[0][3]; + pos.y = mDmEcallBack[i].mpMtx[1][3]; + pos.z = mDmEcallBack[i].mpMtx[2][3]; + pos.y = m35D0; + + dComIfGp_particle_set(0x35A, &pos); + } + } + + endDamageEmitter(); } /* 8012C9D8-8012CA44 .text endDamageEmitter__9daPy_lk_cFv */ From ad22e999602a5e386e8ae8e4cf4883fb0042bce1 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 27 Jul 2024 12:53:17 +0200 Subject: [PATCH 20/30] daPy_lk_c::setSwimWaterDrop matching --- include/d/actor/d_a_player.h | 1 + include/d/actor/d_a_player_main.h | 2 +- src/d/actor/d_a_player_particle.inc | 21 +++++++++++++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index b33bf9ce1..2ef4c5805 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -80,6 +80,7 @@ class daPy_py_c : public fopAc_ac_c { daPyFlg0_UNK8 = 0x00000008, daPyFlg0_DEKU_SP_RETURN_FLG = 0x00000010, daPyFlg0_CUT_AT_FLG = 0x00000040, + daPyFlg0_UNK80 = 0x00000080, daPyFlg0_UNK100 = 0x00000100, daPyFlg0_SHIP_DROP = 0x00000200, daPyFlg0_PUSH_PULL_KEEP = 0x00000800, diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index f85a9d0b3..e08f0062b 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -181,7 +181,7 @@ class daPy_waterDropEcallBack_c : public daPy_followEcallBack_c { static daPy_waterDropPcallBack_c m_pcallback; - /* 0x1C */ u8 field_0x1C[0x4]; + /* 0x1C */ BOOL field_0x1C; }; // Size: 0x20 class daPy_dmEcallBack_c : public daPy_mtxFollowEcallBack_c { diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index e3874ba1a..96357d641 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -589,8 +589,25 @@ void daPy_lk_c::setCutWaterSplash() { } /* 8012C330-8012C45C .text setSwimWaterDrop__9daPy_lk_cFP25daPy_waterDropEcallBack_c */ -void daPy_lk_c::setSwimWaterDrop(daPy_waterDropEcallBack_c*) { - /* Nonmatching */ +void daPy_lk_c::setSwimWaterDrop(daPy_waterDropEcallBack_c* callBack) { + f32 tmp = m35D0 + 10.0f; + if (checkNoResetFlg1(daPy_lk_c::daPyFlg1_WATER_DROP) || !checkNoResetFlg0(daPy_lk_c::daPyFlg0_UNK80) || (callBack->getPos().y > tmp && !checkModeFlg(ModeFlg_SWIM))) { + if (callBack->getEmitter() == NULL && (callBack->field_0x1C || checkNoResetFlg1(daPy_lk_c::daPyFlg1_WATER_DROP))) { + JPABaseEmitter* emitter = dComIfGp_particle_setP1(0x38, &callBack->getPos(), NULL, NULL, 0xFF, callBack); + + if (emitter != NULL) { + emitter->setParticleCallBackPtr(&daPy_waterDropEcallBack_c::m_pcallback); + } + } + + callBack->field_0x1C = FALSE; + offNoResetFlg1(daPy_lk_c::daPyFlg1_WATER_DROP); + } else if (checkNoResetFlg0(daPy_lk_c::daPyFlg0_UNK80) && callBack->getPos().y < m35D0) { + callBack->end(); + if (mCurProc != daPyProc_VOMIT_WAIT_e) { + callBack->field_0x1C = TRUE; + } + } } /* 8012C45C-8012C620 .text setWaterDrop__9daPy_lk_cFv */ From f573f0ff71bace34e0bab70d5f0b2a024daa80aa Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 27 Jul 2024 21:15:48 +0200 Subject: [PATCH 21/30] daPy_lk_c::setItemWaterEffect matching --- src/d/actor/d_a_player_particle.inc | 45 +++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 96357d641..0c1d6abe3 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -763,9 +763,50 @@ void daPy_lk_c::endDamageEmitter() { } /* 8012CA44-8012CD60 .text setItemWaterEffect__9daPy_lk_cFP10fopAc_ac_cii */ -u32 daPy_lk_c::setItemWaterEffect(fopAc_ac_c*, int, int) { - /* Nonmatching */ +u32 daPy_lk_c::setItemWaterEffect(fopAc_ac_c* i_actor, int param_1, int param_2) { static cXyz eff_scale0(0.5f, 0.5f, 0.5f); static cXyz eff_scale2(0.13f, 0.13f, 0.13f); static JGeometry::TVec3 direction(0.0f, 1.0f, 0.0f); + + f32 waterY; + if (fopAcM_getWaterY(&i_actor->current.pos, &waterY) != 0 && ((param_1 != 0 && i_actor->current.pos.y > waterY) || (param_1 == 0 && waterY >= i_actor->current.pos.y))) { + param_1 ^= 1; + if (param_1 == 0 && param_2 == 0) { + return param_1; + } + + f32 deltaY = fabsf(i_actor->old.pos.y - i_actor->current.pos.y); + f32 waterDistY = fabsf(waterY - i_actor->current.pos.y); + cXyz pos; + if (deltaY < 1.0f) { + pos = i_actor->current.pos; + } else { + f32 var_f31 = waterDistY / deltaY; + + if (var_f31 > 1.0f) { + var_f31 = 1.0f; + } + + pos = i_actor->old.pos * var_f31 + i_actor->current.pos * (1.0f - var_f31); + } + + dComIfGp_particle_setSingleRipple(0x3D, &pos, NULL, &eff_scale0); + dComIfGp_particle_setSingleRipple(0x3F, &pos, NULL, &eff_scale0); + + GXColor amb, dif; + dKy_get_seacolor(&amb, &dif); + JPABaseEmitter* emitter = dComIfGp_particle_setP1(0x23, &pos, NULL, &eff_scale2, 0xFF, NULL, -1, &amb); + + if (emitter != NULL) { + emitter->setMaxFrame(1); + emitter->setLifeTime(20); + emitter->setRate(40.0f); + emitter->setAwayFromAxisSpeed(20.0f); + emitter->setDirectionalSpeed(80.0f); + emitter->setSpread(0.0f); + emitter->setDirection(direction); + } + } + + return param_1; } From e067807f1888e4d512de00ac8e05e7ef6151f2ee Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sun, 28 Jul 2024 14:49:23 +0200 Subject: [PATCH 22/30] daPy_lk_c::setFootEffectType matching --- include/d/actor/d_a_player_main.h | 4 +- src/d/actor/d_a_player_particle.inc | 108 ++++++++++++++++++++++++++-- 2 files changed, 103 insertions(+), 9 deletions(-) diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index e08f0062b..5f15fb878 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -84,9 +84,9 @@ class daPy_footEffect_c { void setID(s32 id) { mId = id; } s32 getID() const { return mId; } void setAngle(csXyz* angle) { mAngle = *angle; } - csXyz getAngle() { return mAngle; } + const csXyz& getAngle() { return mAngle; } void setPos(const cXyz* pos) { mPos = *pos; } - cXyz getPos() { return mPos; } + const cXyz& getPos() { return mPos; } /* 0x00 */ dPa_smokeEcallBack mSmokeCb; /* 0x20 */ dPa_followEcallBack mFollowCb; diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 0c1d6abe3..b193f8144 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -515,15 +515,109 @@ void daPy_lk_c::setWaterRipple() { } /* 8012B340-8012B8EC .text setFootEffectType__9daPy_lk_cFiP4cXyzii */ -void daPy_lk_c::setFootEffectType(int, cXyz*, int, int) { - /* Nonmatching */ - static JGeometry::TVec3 run_splash_scale; +void daPy_lk_c::setFootEffectType(int param_0, cXyz* i_pos, int param_2, int param_3) { + static JGeometry::TVec3 run_splash_scale(0.6f, 0.6f, 0.6f); static Vec grass_scale = {1.5f, 1.5f, 1.5f}; - static JGeometry::TVec3 run_grass_scale; + static JGeometry::TVec3 run_grass_scale(0.65f, 0.65f, 0.65f); static Vec smoke_scale = {1.25f, 1.25f, 1.25f}; - static JGeometry::TVec3 heavy_emit_smoke_scale; - static JGeometry::TVec3 heavy_dyn_smoke_scale; - static JGeometry::TVec3 heavy_pat_smoke_scale; + static JGeometry::TVec3 heavy_emit_smoke_scale(1.0f, 0.0f, 1.0f); + static JGeometry::TVec3 heavy_dyn_smoke_scale(0.25f, 0.25f, 0.25f); + static JGeometry::TVec3 heavy_pat_smoke_scale(0.75f, 0.75f, 0.75f); + + JPABaseEmitter* emitter = NULL; + + csXyz angle; + daPy_footEffect_c* footEffect = &m31E8[param_2]; + if (mAcch.ChkGroundHit() && !checkNoResetFlg0(static_cast(daPyFlg0_UNK80000000 | daPyFlg0_UNK20000000))) { + angle.x = getGroundAngle(&mAcch.m_gnd, current.angle.y); + } else { + angle.x = 0; + } + + angle.y = current.angle.y; + angle.z = 0; + + footEffect->setPos(i_pos); + footEffect->setAngle(&angle); + if (param_0 == 0x23) { + if (checkNoResetFlg0(daPyFlg0_UNK80) && m35D0 > 10.0f + i_pos->y) { + footEffect->mPos.y = m35D0 - 10.0f; + } + } else if (mCurProc == daPyProc_CUT_ROLL_e && param_0 == 0x2022) { + param_0 = -2; + } else if (param_3 == 5) { + param_0 = 0x2027; + } + + s32 effectId = footEffect->getID(); + if (param_0 != effectId) { + if (effectId != fpcM_ERROR_PROCESS_ID_e) { + footEffect->getSmokeCallBack()->end(); + footEffect->getOtherCallBack()->end(); + } + + if (param_0 == -2) { + emitter = dComIfGp_particle_setP1(0x2022, &footEffect->getPos(), &footEffect->getAngle(), (cXyz*)&smoke_scale, (u8)daPy_HIO_basic_c0::m.field_0x2, footEffect->getSmokeCallBack(), fopAcM_GetRoomNo(this)); + } else if (param_0 == 0x2022 || param_0 == 0x2027) { + emitter = dComIfGp_particle_setToonP1((u16)param_0, &footEffect->getPos(), &footEffect->getAngle(), (cXyz*)&smoke_scale, (u8)daPy_HIO_basic_c0::m.field_0x2, footEffect->getSmokeCallBack(), fopAcM_GetRoomNo(this)); + } else if (param_0 == 0x24) { + GXColor color = {tevStr.mColorC0.r, tevStr.mColorC0.g, tevStr.mColorC0.b, tevStr.mColorC0.a}; + emitter = dComIfGp_particle_setP1((u16)param_0, &footEffect->getPos(), &footEffect->getAngle(), (cXyz*)&grass_scale, 0xFF, footEffect->getOtherCallBack(), -1, &color, &tevStr.mColorK0); + } else { + GXColor amb, dif; + dKy_get_seacolor(&amb, &dif); + emitter = dComIfGp_particle_setP1((u16)param_0, &footEffect->getPos(), &footEffect->getAngle(), NULL, 0xFF, footEffect->getOtherCallBack(), -1, &amb); + } + + if (emitter != NULL) { + footEffect->setID(param_0); + } + + if (param_0 == -2) { + param_0 = 0x2022; + } + } + + if (emitter != NULL) { + if (param_3 == 5) { + if (param_0 == 0x2027) { + emitter->setLifeTime(40); + emitter->setRate(10.0f); + emitter->setEmitterScale(heavy_emit_smoke_scale); + emitter->setGlobalDynamicsScale(heavy_dyn_smoke_scale); + emitter->setGlobalParticleScale(heavy_pat_smoke_scale); + } else { + emitter->setRate(15.0f); + emitter->setSpread(1.0f); + if (param_0 == 0x24) { + emitter->setDirectionalSpeed(12.0f); + } + } + } else if (param_3 == 1) { + emitter->setRate(16.0f); + emitter->setSpread(1.0f); + } else if (param_3 == 3) { + emitter->setRate(8.0f); + emitter->setSpread(0.3f); + } else if (param_3 == 2) { + if (param_0 == 0x24) { + emitter->setGlobalScale(run_grass_scale); + emitter->setRate(10.0f); + emitter->setSpread(1.0f); + emitter->setLifeTime(15); + } else { + emitter->setRate(18.0f); + emitter->setSpread(1.0f); + emitter->setGlobalScale(run_splash_scale); + } + } else if (param_3 == 4 && param_0 == 0x23) { + emitter->setRate(3.0f); + emitter->setSpread(0.2f); + } else { + emitter->setRate(3.0f); + emitter->setSpread(0.05f); + } + } } /* 8012B8EC-8012B9DC .text setFootMark__9daPy_lk_cFP4cXyz */ From 9bbf006d244ffff027a161b48aba906db5a06b93 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Mon, 29 Jul 2024 18:53:32 +0200 Subject: [PATCH 23/30] daPy_lk_c::setFootEffect matching --- include/d/actor/d_a_player.h | 1 + include/d/actor/d_a_player_main.h | 10 +- include/d/d_com_inf_game.h | 2 + include/d/d_particle.h | 2 +- src/d/actor/d_a_player_main.cpp | 2 +- src/d/actor/d_a_player_particle.inc | 178 ++++++++++++++++++++++++++-- src/d/d_particle.cpp | 12 +- 7 files changed, 191 insertions(+), 16 deletions(-) diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index 2ef4c5805..c5247a7ae 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -136,6 +136,7 @@ class daPy_py_c : public fopAc_ac_c { enum daPy_RFLG0 { daPyRFlg0_UNK2 = 0x00000002, daPyRFlg0_ROPE_GRAB_RIGHT_HAND = 0x00000004, + daPyRFlg0_UNK10 = 0x00000010, daPyRFlg0_GRAB_UP_END = 0x00000020, daPyRFlg0_AUTO_JUMP_LAND = 0x00000040, daPyRFlg0_UNK80 = 0x00000080, diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 5f15fb878..6d23a3fe2 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -161,13 +161,13 @@ class daPy_followEcallBack_c : public dPa_levelEcallBack { void end(); ~daPy_followEcallBack_c() {} JPABaseEmitter* getEmitter() { return mpEmitter; } - void setPos(const cXyz* pos) { field_0x08 = *pos; } - cXyz& getPos() { return field_0x08; } - void setAngle(s16 x, s16 y, s16 z) { field_0x14.set(x, y, z); } + void setPos(const cXyz* pos) { mPos = *pos; } + cXyz& getPos() { return mPos; } + void setAngle(s16 x, s16 y, s16 z) { mAngle.set(x, y, z); } /* 0x04 */ JPABaseEmitter* mpEmitter; - /* 0x08 */ cXyz field_0x08; - /* 0x14 */ csXyz field_0x14; + /* 0x08 */ cXyz mPos; + /* 0x14 */ csXyz mAngle; /* 0x1A */ u8 field_0x1A[0x1C - 0x1A]; }; // Size: 0x1C diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 5b70d56b8..c16c4d415 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -3403,6 +3403,8 @@ inline u32 dComIfGp_particle_getParticleNum() { return g_dComIfG_gameInfo.play.g inline u32 dComIfGp_particle_getEmitterNum() { return g_dComIfG_gameInfo.play.getParticle()->getEmitterNum(); } inline JKRHeap* dComIfGp_particle_getCommonHeap() { return g_dComIfG_gameInfo.play.getParticle()->getHeap(); } +inline s32 dComIfGp_particle_checkAtrCodeEffect(int code) { return g_dComIfG_gameInfo.play.getParticle()->checkAtrCodeEffect(code); } + /** * === ATTENTION === */ diff --git a/include/d/d_particle.h b/include/d/d_particle.h index 735c056b1..b82a6c0cf 100644 --- a/include/d/d_particle.h +++ b/include/d/d_particle.h @@ -372,7 +372,7 @@ class dPa_control_c { void setSimpleLand(int, cXyz const*, csXyz const*, f32, f32, f32, dKy_tevstr_c*, int*, int); void setSimpleLand(cBgS_PolyInfo&, cXyz const*, csXyz const*, f32, f32, f32, dKy_tevstr_c*, int*, int); - void checkAtrCodeEffect(int); + s32 checkAtrCodeEffect(int); void setNormalStripes(u16, cXyz const*, csXyz const*, cXyz const*, u8, u16); bool newSimple(u16, u8); bool setSimple(u16, cXyz const*, u8, GXColor const&, GXColor const&, int); diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 5dfdf1ff5..83bfe272f 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -3782,7 +3782,7 @@ BOOL daPy_lk_c::playerDelete() { dKy_plight_cut(&mLightInfluence); mDoAud_seDeleteObject(&mSwordTopPos); mDoAud_seDeleteObject(&mRopePos); - mDoAud_seDeleteObject(&m338C.field_0x08); + mDoAud_seDeleteObject(&m338C.mPos); mDoAud_seDeleteObject(mFanWindCps.GetEndP()); for (i = 0; i < (int)ARRAY_SIZE(m_anm_heap_under); i++) { diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index b193f8144..029fff0e2 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -383,12 +383,12 @@ void daPy_waterDropPcallBack_c::execute(JPABaseEmitter* emitter, JPABaseParticle /* 80129F48-80129F98 .text execute__22daPy_followEcallBack_cFP14JPABaseEmitter */ void daPy_followEcallBack_c::execute(JPABaseEmitter* emitter) { - JGeometry::TVec3 pos(field_0x08.x, field_0x08.y, field_0x08.z); + JGeometry::TVec3 pos(mPos.x, mPos.y, mPos.z); emitter->setGlobalTranslation(pos); JGeometry::TVec3 rot; - rot.x = field_0x14.x; - rot.y = field_0x14.y; - rot.z = field_0x14.z; + rot.x = mAngle.x; + rot.y = mAngle.y; + rot.z = mAngle.z; emitter->setGlobalRotation(rot); } @@ -637,7 +637,171 @@ void daPy_lk_c::setFootMark(cXyz* i_pos) { /* 8012B9DC-8012C128 .text setFootEffect__9daPy_lk_cFv */ void daPy_lk_c::setFootEffect() { - /* Nonmatching */ + if (!mAcch.ChkGroundHit() || checkNoResetFlg0(daPyFlg0_UNK80000000)) { + resetFootEffect(); + m3410.end(); + return; + } + + cXyz pos; + if (getFootOnGround()) { + if (getRightFootOnGround()) { + MtxP mtx = mpCLModel->getAnmMtx(0x27); + pos.x = mtx[0][3]; + pos.y = mtx[1][3]; + pos.z = mtx[2][3]; + setFootMark(&pos); + } + + if (getLeftFootOnGround()) { + MtxP mtx = mpCLModel->getAnmMtx(0x22); + pos.x = mtx[0][3]; + pos.y = mtx[1][3]; + pos.z = mtx[2][3]; + setFootMark(&pos); + } + } + + if (checkResetFlg0(daPyRFlg0_UNK10) && mCurrAttributeCode == dBgS_Attr_WATER_e && m35D0 > 25.0f + current.pos.y) { + cXyz& p = m3410.getPos(); + p.x = current.pos.x + 45.0f * cM_ssin(current.angle.y); + p.y = m35D0; + p.z = current.pos.z + 45.0f * cM_scos(current.angle.y); + + m3410.setAngle(0, current.angle.y + 0x8000, 0); + + if (m3410.mpEmitter == NULL) { + GXColor amb, dif; + dKy_get_seacolor(&amb, &dif); + + JPABaseEmitter* emitter = dComIfGp_particle_setP1(0x23, &p, NULL, NULL, 0xFF, &m3410, -1, &amb); + if (emitter != NULL) { + emitter->setLifeTime(15); + emitter->setRate(4.0f); + emitter->setSpread(0.6f); + emitter->setDirectionalSpeed(11.0f); + } + } + } else { + m3410.end(); + } + + if (strcmp(dComIfGp_getStartStageName(), "Adanmae") == 0) { + if (checkResetFlg0(daPyRFlg0_UNK10)) { + if (getFootOnGround() && m35D0 <= current.pos.y) { + dComIfGp_particle_setP1(0x8237, &pos, ¤t.angle); + } + } + } + + s32 temp_r3_4 = dComIfGp_particle_checkAtrCodeEffect(mCurrAttributeCode); + if (temp_r3_4 == -1) { + return; + } + + s32 var_r29; + if (checkResetFlg0(daPyRFlg0_UNK10) && getFootOnGround() && (checkHeavyStateOn() || temp_r3_4 == 0x23 || temp_r3_4 == 0x24)) { + if (getRightFootOnGround()) { + m34BE = 2; + } else { + m34BE = 1; + } + + if (checkHeavyStateOn()) { + var_r29 = 5; + dComIfGp_getVibration().StartShock(2, -0x31, cXyz(0.0f, 1.0f, 0.0f)); + } else { + var_r29 = 2; + } + + } else { + if (mCurProc == daPyProc_JUMP_CUT_LAND_e) { + var_r29 = 3; + } else if (mCurProc == daPyProc_FRONT_ROLL_e) { + var_r29 = 4; + } else { + var_r29 = 0; + } + } + + if (m34BE == 0) { + return; + } + + if (mCurProc == daPyProc_DEMO_LAST_COMBO_e) { + f32 rnd = cM_rndFX(17.5f); + cXyz sp44 = m370C; + MtxP mtx = mpCLModel->getAnmMtx(0x1); + m370C.x = mtx[0][3]; + m370C.y = mtx[1][3]; + m370C.z = mtx[2][3]; + if (m3570 != 0) { + current.angle.y = shape_angle.y - 0x4000; + m3570 = 0; + } else { + cXyz sp38 = m370C - sp44; + current.angle.y = cM_atan2s(sp38.x, sp38.z); + } + + pos.x = m370C.x + rnd * cM_scos(current.angle.y); + pos.y = current.pos.y; + pos.z = m370C.z - rnd * cM_scos(current.angle.y); + setFootEffectType(temp_r3_4, &pos, 0, var_r29); + } else { + if (m34BE == 4) { + f32 rnd = cM_rndFX(17.5f); + pos.x = current.pos.x + rnd * cM_scos(current.angle.y); + pos.y = current.pos.y; + pos.z = current.pos.z - rnd * cM_scos(current.angle.y); + setFootEffectType(temp_r3_4, &pos, 0, var_r29); + + } else if (m34BE == 3) { + if (mCurrAttributeCode == dBgS_Attr_GRASS_e || mCurrAttributeCode == dBgS_Attr_WATER_e) { + MtxP mtx = mpCLModel->getAnmMtx(0x27); + pos.x = mtx[0][3]; + pos.y = mtx[1][3]; + pos.z = mtx[2][3]; + setFootEffectType(temp_r3_4, &pos, 0, var_r29); + + mtx = mpCLModel->getAnmMtx(0x22); + pos.x = mtx[0][3]; + pos.y = mtx[1][3]; + pos.z = mtx[2][3]; + setFootEffectType(temp_r3_4, &pos, 1, var_r29); + + } else { + setFootEffectType(temp_r3_4, ¤t.pos, 0, var_r29); + } + } else if (m34BE == 1) { + MtxP mtx = mpCLModel->getAnmMtx(0x22); + pos.x = mtx[0][3]; + pos.y = mtx[1][3]; + pos.z = mtx[2][3]; + setFootEffectType(temp_r3_4, &pos, 0, var_r29); + } else if (m34BE == 2) { + MtxP mtx = mpCLModel->getAnmMtx(0x27); + pos.x = mtx[0][3]; + pos.y = mtx[1][3]; + pos.z = mtx[2][3]; + setFootEffectType(temp_r3_4, &pos, 0, var_r29); + } else if (m34BE == 5) { + setFootEffectType(temp_r3_4, ¤t.pos, 0, 1); + } else if (m34BE == 6) { + MtxP mtx = mpCLModel->getAnmMtx(0); + pos.x = mtx[0][3]; + pos.y = mtx[1][3]; + pos.z = mtx[2][3]; + + mGndChk.SetPos(&pos); + + f32 groundY = dComIfG_Bgsp()->GroundCross(&mGndChk); + if (groundY != -1e9f) { + pos.y = groundY; + } + + setFootEffectType(temp_r3_4, &pos, 0, 1); + } + } } /* 8012C128-8012C1A8 .text resetFootEffect__9daPy_lk_cFv */ @@ -711,13 +875,13 @@ void daPy_lk_c::setWaterDrop() { tmp.x = mtx[0][3]; tmp.y = mtx[1][3]; tmp.z = mtx[2][3]; - m334C.field_0x08 = tmp; + m334C.setPos(&tmp); mtx = mpCLModel->getAnmMtx(0x02); tmp.x = mtx[0][3]; tmp.y = mtx[1][3]; tmp.z = mtx[2][3]; - m336C.field_0x08 = tmp; + m336C.setPos(&tmp); if (mModeFlg & ModeFlg_00000001) { daPy_waterDropEcallBack_c::m_pcallback.field_0x4 = TRUE; diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index b93df24f6..a0421a27b 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -716,8 +716,16 @@ void dPa_control_c::setSimpleLand(cBgS_PolyInfo&, const cXyz*, const csXyz*, f32 } /* 8007DA58-8007DAA8 .text checkAtrCodeEffect__13dPa_control_cFi */ -void dPa_control_c::checkAtrCodeEffect(int) { - /* Nonmatching */ +s32 dPa_control_c::checkAtrCodeEffect(int code) { + if (code == dBgS_Attr_WATER_e) { + return 0x23; + } else if (code == dBgS_Attr_GRASS_e) { + return 0x24; + } else if (code != dBgS_Attr_UNK1B_e && code != dBgS_Attr_ICE_e && code != dBgS_Attr_GIANT_FLOWER_e && code != dBgS_Attr_CARPET_e) { + return 0x2022; + } else { + return -1; + } } /* 8007DAA8-8007DB34 .text setNormalStripes__13dPa_control_cFUsPC4cXyzPC5csXyzPC4cXyzUcUs */ From 4f501d8c4bd580b4d738311714544594a5c36d70 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 2 Aug 2024 15:10:07 +0200 Subject: [PATCH 24/30] daPy_lk_c::setAuraEffect work --- src/d/actor/d_a_player_particle.inc | 128 +++++++++++++++++++++++++++- 1 file changed, 127 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 029fff0e2..de3ae98c7 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -11,9 +11,11 @@ */ #include "d/actor/d_a_player_main.h" +#include "d/actor/d_a_player_main_data.h" #include "d/actor/d_a_player_HIO.h" -#include "d/d_procname.h" #include "d/actor/d_a_sea.h" +#include "d/actor/d_a_ship.h" +#include "d/d_procname.h" #include "f_op/f_op_kankyo_mng.h" #include "m_Do/m_Do_lib.h" #include "SSystem/SComponent/c_math.h" @@ -500,6 +502,130 @@ void daPy_lk_c::setAuraEffect() { 0x0021, 0x0026, }; + + + J3DAnmTevRegKey* curYaura00Brk = mYaura00rBrk.getBrkAnm(); + J3DAnmTevRegKey* curYmgcs00Brk = mYmgcs00Brk.getBrkAnm(); + f32 temp_f29 = curYaura00Brk->getFrame(); + f32 temp_f31 = curYmgcs00Brk->getFrame(); + f32 y00BtkFrameMax = mpYaura00Btk->getFrameMax(); + + if (checkNoDamageMode()) { + J3DAnmTevRegKey* pYaura00Brk; + J3DAnmTevRegKey* pYmgcs00Brk; + + if (checkEquipDragonShield()) { + if (dComIfGp_event_getMode() == 0) { + m3548 -= 1; + } + + if (m3548 == 0) { + if (dComIfGs_getMagic() != 0) { + m3548 = daPy_HIO_magicShield_c0::m.field_0x0; + dComIfGp_setItemMagicCount(-1); + } else { + offNoResetFlg1(daPyFlg1_EQUIP_DRAGON_SHIELD); + } + } + + pYaura00Brk = static_cast(dComIfG_getObjectRes(l_arcName, LINK_BRK_YAURA00_R)); + pYmgcs00Brk = static_cast(dComIfG_getObjectRes(l_arcName, LINK_BRK_YMGCS00_MS)); + } else { + if (dComIfGp_event_getMode() == 0) { + mTinkleShieldTimer -= 1; + } + + pYaura00Brk = static_cast(dComIfG_getObjectRes(l_arcName, LINK_BRK_YAURA00_G)); + pYmgcs00Brk = static_cast(dComIfG_getObjectRes(l_arcName, LINK_BRK_YMGCS00_TS)); + } + + if (pYaura00Brk != curYaura00Brk) { + mYaura00rBrk.init(mMagicArmorAuraEntries[0].getModel()->getModelData(), pYaura00Brk, FALSE, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, 0, -1, true, 0); + curYaura00Brk = pYaura00Brk; + } + + if (pYmgcs00Brk != curYmgcs00Brk) { + mYmgcs00Brk.init(mpYmgcs00Model->getModelData(), pYmgcs00Brk, FALSE, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, 0, -1, true, 0); + curYmgcs00Brk = pYmgcs00Brk; + } + } + + f32 var_f28, var_f31; + if (checkNoDamageMode() && (dComIfGp_event_getMode() == 0 || (eventInfo.checkCommandDoor() && !dComIfGp_event_chkEventFlag(dEvtFlag_TALK_e))) ) { + if (temp_f29 < 0.01f) { + for (int idx = 0; idx < (int)ARRAY_SIZE(mMagicArmorAuraEntries); idx++) { + mMagicArmorAuraEntries[idx].setFrame(cM_rndF(y00BtkFrameMax)); + } + } + + var_f28 = temp_f29 + 1.0f; + if (var_f28 >= curYaura00Brk->getFrameMax()) { + var_f28 = curYaura00Brk->getFrameMax() - 0.001f; + } + + var_f31 = temp_f31 + 1.0f; + if (var_f31 >= curYmgcs00Brk->getFrameMax()) { + var_f31 = curYmgcs00Brk->getFrameMax() - 0.001f; + } + + seStartMapInfo(JA_SE_LK_MG_SHELD_USING); + } else { + var_f28 = temp_f29 - 1.0f; + if (var_f28 < 0.0f) { + var_f28 = 0.0f; + } + + var_f31 = temp_f31 - 1.0f; + if (var_f31 < 0.0f) { + var_f31 = 0.0f; + } + } + + mYaura00rBrk.entryFrame(var_f28); + mYmgcs00Brk.entryFrame(var_f31); + if (var_f28 > 0.0f) { + f32 var_f31_2, var_f28_2; + daPy_aura_c* auraEntry = mMagicArmorAuraEntries; + if (dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e) && dComIfGp_getShipActor() != NULL) { + var_f31_2 = 0.0f; + var_f28_2 = 1.0f + (fabsf(dComIfGp_getShipActor()->speedF) / 15.0f); + if (var_f28_2 > 1.5f) { + var_f28_2 = 1.5f; + } + } else { + var_f31_2 = fabsf(mVelocity) / daPy_HIO_move_c0::m.field_0x18; + if (var_f31_2 > 1.0f) { + var_f31_2 = 1.0f; + } + var_f28_2 = 1.0f; + } + + cXyz localScale = scale * (var_f28_2 * cM_fcos(M_PI * (0.5f * var_f31_2))); + + for (int idx = 0; idx < (int)ARRAY_SIZE(mMagicArmorAuraEntries); idx++, auraEntry++) { + f32 var_f0 = 1.0f + auraEntry->getFrame(); + if (var_f0 >= y00BtkFrameMax) { + var_f0 -= y00BtkFrameMax; + } + auraEntry->setFrame(var_f0); + auraEntry->getModel()->setBaseTRMtx(mpCLModel->getAnmMtx(aura_model_joint[idx])); + + if (idx == 0) { + auraEntry->getModel()->setBaseScale(scale * var_f31_2 * 1.2f); + } else if (idx != 1) { + auraEntry->getModel()->setBaseScale(localScale); + } else { + auraEntry->getModel()->setBaseScale((scale * (1.0f - (0.3f * var_f31_2))) * 2.0f); + } + + } + } + + if (checkNoDamageMode() || mYmgcs00Brk.getBrkAnm()->getFrame() > 0.0f) { + mpYmgcs00Model->setBaseTRMtx(mpCLModel->getBaseTRMtx()); + mpYmgcs00Model->calc(); + simpleAnmPlay(mpYmgcs00Btk); + } } /* 8012A8D8-8012B340 .text setWaterRipple__9daPy_lk_cFv */ From 1a11c7989807630d0d9371ce02cb60003a509a8a Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:08:07 +0200 Subject: [PATCH 25/30] daPy_lk_c::setWaterRipple matching --- include/d/actor/d_a_player.h | 2 +- src/d/actor/d_a_player_main.cpp | 2 +- src/d/actor/d_a_player_particle.inc | 186 +++++++++++++++++++++++++++- 3 files changed, 184 insertions(+), 6 deletions(-) diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index c5247a7ae..bcb752b40 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -348,7 +348,7 @@ class daPy_py_c : public fopAc_ac_c { /* 0x29C */ u32 mNoResetFlg0; /* 0x2A0 */ u32 mNoResetFlg1; /* 0x2A4 */ u32 mResetFlg0; - /* 0x2A8 */ f32 field_0x2a8; + /* 0x2A8 */ f32 mMaxNormalSpeed; /* 0x2AC */ f32 mHeight; /* 0x2B0 */ f32 field_0x2b0; /* 0x2B4 */ csXyz mBodyAngle; diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 83bfe272f..ecd72e9e2 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -4189,7 +4189,7 @@ void daPy_lk_c::playerInit() { mAcch.OnLineCheck(); mAcch.ClrRoofNone(); mAcch.SetRoofCrrHeight(125.0f); - field_0x2a8 = daPy_HIO_move_c0::m.field_0x18; + mMaxNormalSpeed = daPy_HIO_move_c0::m.field_0x18; gravity = daPy_HIO_autoJump_c0::m.field_0xC; maxFallSpeed = daPy_HIO_autoJump_c0::m.field_0x10; mAcchCir[0].SetWall(30.1f, 35.0f); diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index de3ae98c7..34aed7d8e 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -630,14 +630,192 @@ void daPy_lk_c::setAuraEffect() { /* 8012A8D8-8012B340 .text setWaterRipple__9daPy_lk_cFv */ void daPy_lk_c::setWaterRipple() { - /* Nonmatching */ static Vec waterfall_ripple_scale = {0.75f, 0.75f, 0.75f}; - static JGeometry::TVec3 normal_ripple_scale; - static JGeometry::TVec3 small_ripple_scale; - static JGeometry::TVec3 waterfall_splash_trans; + static JGeometry::TVec3 normal_ripple_scale(1.0f, 1.0f, 1.0f); + static JGeometry::TVec3 small_ripple_scale(0.4f, 0.4f, 0.4f); static const Vec wave_offset = {0.0f, 18.0f, 0.0f}; static const Vec swim_offset = {0.0f, 30.0f, 0.0f}; static const Vec swim_side_offset = {0.0f, 0.0f, 30.0f}; + + // Probably fakematch + BOOL var_r3; + if (mCurProc == daPyProc_DEMO_DEAD_e && dComIfGp_checkPlayerStatus0(0, daPyStts0_SWIM_e)) { + var_r3 = TRUE; + } else { + var_r3 = FALSE; + } + + // Probably fakematch (May use inlines?) + if ((var_r3 && m34D6 != 0) || + (mCurProc != daPyProc_VOMIT_WAIT_e && !var_r3 && (!checkModeFlg(ModeFlg_IN_SHIP | ModeFlg_HANG) || checkModeFlg(ModeFlg_SWIM)) && ((checkNoResetFlg0(daPyFlg0_UNK80) && m35D0 > 5.0f + mCyl.GetC().y && m35D0 < mCyl.GetC().y + mCyl.GetH()) || (mCurrAttributeCode == dBgS_Attr_WATER_e && mAcch.ChkGroundHit()))) + ) { + + if (m3280.getEmitter() == NULL) { + dComIfGp_particle_setShipTail(0x33, ¤t.pos, NULL, NULL, 0xFF, &m3280); + } + + f32 var_f1 = (0.1f * fabsf(getSpeedF())); + var_f1 *= var_f1; + if (var_f1 > 1.0f) { + var_f1 = 1.0f; + } + m3280.setRate(var_f1); + simpleAnmPlay(mpSuimenMunyaBtk); + + JPABaseEmitter* emitter = m3280.getEmitter(); + if (emitter != NULL && ((emitter->mGlobalParticleScale.x < 0.8f && checkNoResetFlg0(daPyFlg0_UNK80)) || (emitter->mGlobalParticleScale.x > 0.8f && !checkNoResetFlg0(daPyFlg0_UNK80)))) { + m3280.end(); + + emitter = dComIfGp_particle_setShipTail(0x33, ¤t.pos, NULL, NULL, 0xFF, &m3280); + } + + if (emitter != NULL) { + if (checkNoResetFlg0(daPyFlg0_UNK80)) { + emitter->setGlobalScale(normal_ripple_scale); + } else { + emitter->setGlobalScale(small_ripple_scale); + } + } + } else if (m3280.getEmitter() != NULL) { + m3280.end(); + } + + if (checkModeFlg(ModeFlg_SWIM)) { + if (!mSwimTailEcallBack[0].field_0x04) { + mSwimTailEcallBack[0].field_0x08 = fabsf(mVelocity / mMaxNormalSpeed); + } + + if (!mSwimTailEcallBack[1].field_0x04) { + mSwimTailEcallBack[1].field_0x08 = fabsf(mVelocity / mMaxNormalSpeed); + } + cXyz local_1c; + cMtx_multVec(mpCLModel->getAnmMtx(15), &wave_offset, &local_1c); + + cXyz local_20; + cXyz local_28; + local_1c.y = m35D0; + + f32 cos = cM_scos(shape_angle.y) * 5.0f; + f32 sin = cM_ssin(shape_angle.y) * 5.0f; + + local_20.x = local_1c.x + cos; + local_20.y = local_1c.y; + local_20.z = local_1c.z - sin; + local_28.x = local_1c.x - cos; + local_28.y = local_1c.y; + local_28.z = local_1c.z + sin; + mSwimTailEcallBack[0].mPos.set(local_20); + mSwimTailEcallBack[0].field_0x0C = m35D0 + 2.0f; + mSwimTailEcallBack[0].field_0x10 = mAcch.m_wtr.GetHeight(); + mSwimTailEcallBack[1].mPos.set(local_28); + mSwimTailEcallBack[1].field_0x0C = m35D0 + 2.0f; + mSwimTailEcallBack[1].field_0x10 = mAcch.m_wtr.GetHeight(); + + cXyz local_40; + cMtx_multVec(mpCLModel->getAnmMtx(15), &swim_offset, &local_40); + MtxP suimenMunyaMtx = mpSuimenMunyaModel->getBaseTRMtx(); + + cXyz local_4c; + local_4c.x = suimenMunyaMtx[0][3]; + local_4c.y = suimenMunyaMtx[1][3]; + local_4c.z = suimenMunyaMtx[2][3]; + + local_40.y = m35D0; + + local_4c -= local_40; + + cXyz local_50; + local_50.z = (local_4c.absXZ() / mMaxNormalSpeed) * 0.5f + 1.0f; + if (local_50.z > 1.5f) { + local_50.z = 1.5f; + } + local_50.x = 1.0f; + local_50.y = 1.0f; + + if (mCurProc == daPyProc_DEMO_DEAD_e) { + mDoMtx_stack_c::transS(current.pos.x + cM_ssin(shape_angle.y) * 60.0f, local_40.y + 2.0f, current.pos.z + cM_scos(shape_angle.y) * 60.0f); + } else { + mDoMtx_stack_c::transS(local_40.x, local_40.y + 2.0f, local_40.z); + } + + if (dPa_control_c::isStatus(0x01)) { + MtxP mtx = mpCLModel->getAnmMtx(15); + cXyz local_5c; + local_5c.x = mtx[0][3]; + local_5c.y = mtx[1][3]; + local_5c.z = mtx[2][3]; + + cXyz local_68; + cMtx_multVec(mtx, &swim_side_offset, &local_68); + cXyz local_74(local_5c.x * 2.0f - local_68.x, local_5c.y, local_5c.z * 2.0f - local_68.z); + cXyz local_80(local_5c.x * 2.0f - local_40.x, local_5c.y, local_5c.z * 2.0f - local_40.z); + + if (daSea_ChkArea(local_68.x, local_68.z)) { + local_68.y = daSea_calcWave(local_68.x, local_68.z); + } + + if (daSea_ChkArea(local_74.x, local_74.z)) { + local_74.y = daSea_calcWave(local_74.x, local_74.z); + } + + if (daSea_ChkArea(local_80.x, local_80.z)) { + local_80.y = daSea_calcWave(local_80.x, local_80.z); + } + + cXyz local_b8 = local_40 - local_80; + cXyz local_c4 = local_74 - local_68; + + mDoMtx_stack_c::ZXYrotM(cM_atan2s(-local_b8.y, local_b8.absXZ()), shape_angle.y, cM_atan2s(-local_c4.y, local_c4.absXZ())); + } else { + mDoMtx_stack_c::YrotM(shape_angle.y); + } + + mpSuimenMunyaModel->setBaseTRMtx(mDoMtx_stack_c::get()); + mpSuimenMunyaModel->setBaseScale(local_50); + } + + static JGeometry::TVec3 waterfall_splash_trans(0.0f, 15.0f, 0.0f); + + if (((mAcch.ChkGroundHit() || checkModeFlg(ModeFlg_SWIM)) && mCurrAttributeCode == dBgS_Attr_WATERFALL_e) || (checkModeFlg(ModeFlg_HANG) && m3588 == 0x17)) { + if (m3400.getEmitter() == NULL) { + m3400.makeEmitter(0x23, mpCLModel->getAnmMtx(15), ¤t.pos, NULL); + JPABaseEmitter* emitter = m3400.getEmitter(); + + if (emitter != NULL) { + emitter->setRate(4.0f); + emitter->setSpread(1.0f); + emitter->setEmitterTranslation(waterfall_splash_trans); + } + } + + if (m34CD == 0) { + MtxP mtx = mpCLModel->getAnmMtx(0); + cXyz local_ac; + local_ac.x = mtx[0][3]; + local_ac.y = mtx[1][3]; + local_ac.z = mtx[2][3]; + dComIfGp_particle_setSingleRipple(0x3F, &local_ac, NULL, (cXyz*)&waterfall_ripple_scale); + m34CD = 15; + dComIfGp_getVibration().StartQuake(4, 1, cXyz(0.0f, 1.0f, 0.0f)); + } else { + m34CD -= 1; + if (m34CD == 5) { + dComIfGp_getVibration().StopQuake(-1); + } + } + } else { + if (m3400.getEmitter() != NULL) { + dComIfGp_getVibration().StopQuake(-1); + } + + m3400.end(); + } + + if (m3400.getEmitter() != NULL) { + GXColor amb, dif; + dKy_get_seacolor(&amb, &dif); + m3400.getEmitter()->setGlobalPrmColor(amb.r, amb.g, amb.b); + } } /* 8012B340-8012B8EC .text setFootEffectType__9daPy_lk_cFiP4cXyzii */ From f73b49f835f999df939b536581fae496514c34d5 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Thu, 8 Aug 2024 13:08:53 +0200 Subject: [PATCH 26/30] d_a_player_particle minor cleanup --- src/d/actor/d_a_player_particle.inc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 34aed7d8e..642fa5c7b 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -254,7 +254,7 @@ void daPy_swBlur_c::copySwBlur(MtxP mtx, int param_2) { field_0x304[i + var_r31] = field_0x304[i]; } - // Very obvious fakematch + // Probably fakematch f32 var_f31 = 0.0f; f32 frac = 1.0f / var_r31; int i; @@ -1111,6 +1111,7 @@ void daPy_lk_c::setFootEffect() { /* 8012C128-8012C1A8 .text resetFootEffect__9daPy_lk_cFv */ void daPy_lk_c::resetFootEffect() { // Fakematch? + // Should probably use array indexing daPy_footEffect_c* pFootEffect = m31E8; for (int idx = 0; idx < (s32)ARRAY_SIZE(m31E8); idx++) { pFootEffect[0].getSmokeCallBack()->end(); @@ -1187,7 +1188,7 @@ void daPy_lk_c::setWaterDrop() { tmp.z = mtx[2][3]; m336C.setPos(&tmp); - if (mModeFlg & ModeFlg_00000001) { + if (checkModeFlg(ModeFlg_00000001)) { daPy_waterDropEcallBack_c::m_pcallback.field_0x4 = TRUE; } else { daPy_waterDropEcallBack_c::m_pcallback.field_0x4 = FALSE; @@ -1257,7 +1258,7 @@ void daPy_lk_c::setDamageCurseEmitter() { if (!daPy_dmEcallBack_c::checkCurse()) { endDamageEmitter(); - mDmEcallBack->makeEmitter(0x815B, mpCLModel->getAnmMtx(0x1E), ¤t.pos, NULL); + mDmEcallBack[0].makeEmitter(0x815B, mpCLModel->getAnmMtx(0x1E), ¤t.pos, NULL); if (checkUpperReadyThrowAnime()) { resetActAnimeUpper(UPPER_MOVE2_e, -1.0f); From 4e2cac6babd042aee87b221416c9933f0e002728 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:21:39 +0200 Subject: [PATCH 27/30] daPy_lk_c::setAuraEffect matching --- src/d/actor/d_a_player_particle.inc | 64 ++++++++++++++--------------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 642fa5c7b..4ef645089 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -481,7 +481,6 @@ void daPy_dmEcallBack_c::execute(JPABaseEmitter* emitter) { /* 8012A288-8012A8D8 .text setAuraEffect__9daPy_lk_cFv */ void daPy_lk_c::setAuraEffect() { - /* Nonmatching */ static const u16 aura_emitter_joint[] = { 0x0007, 0x000B, @@ -503,11 +502,10 @@ void daPy_lk_c::setAuraEffect() { 0x0026, }; - J3DAnmTevRegKey* curYaura00Brk = mYaura00rBrk.getBrkAnm(); J3DAnmTevRegKey* curYmgcs00Brk = mYmgcs00Brk.getBrkAnm(); - f32 temp_f29 = curYaura00Brk->getFrame(); - f32 temp_f31 = curYmgcs00Brk->getFrame(); + f32 yauraFrame = curYaura00Brk->getFrame(); + f32 ymgcsFrame = curYmgcs00Brk->getFrame(); f32 y00BtkFrameMax = mpYaura00Btk->getFrameMax(); if (checkNoDamageMode()) { @@ -550,57 +548,56 @@ void daPy_lk_c::setAuraEffect() { } } - f32 var_f28, var_f31; if (checkNoDamageMode() && (dComIfGp_event_getMode() == 0 || (eventInfo.checkCommandDoor() && !dComIfGp_event_chkEventFlag(dEvtFlag_TALK_e))) ) { - if (temp_f29 < 0.01f) { + if (yauraFrame < 0.01f) { for (int idx = 0; idx < (int)ARRAY_SIZE(mMagicArmorAuraEntries); idx++) { mMagicArmorAuraEntries[idx].setFrame(cM_rndF(y00BtkFrameMax)); } } - var_f28 = temp_f29 + 1.0f; - if (var_f28 >= curYaura00Brk->getFrameMax()) { - var_f28 = curYaura00Brk->getFrameMax() - 0.001f; + yauraFrame += 1.0f; + if (yauraFrame >= curYaura00Brk->getFrameMax()) { + yauraFrame = curYaura00Brk->getFrameMax() - 0.001f; } - var_f31 = temp_f31 + 1.0f; - if (var_f31 >= curYmgcs00Brk->getFrameMax()) { - var_f31 = curYmgcs00Brk->getFrameMax() - 0.001f; + ymgcsFrame += 1.0f; + if (ymgcsFrame >= curYmgcs00Brk->getFrameMax()) { + ymgcsFrame = curYmgcs00Brk->getFrameMax() - 0.001f; } seStartMapInfo(JA_SE_LK_MG_SHELD_USING); } else { - var_f28 = temp_f29 - 1.0f; - if (var_f28 < 0.0f) { - var_f28 = 0.0f; + yauraFrame -= 1.0f; + if (yauraFrame < 0.0f) { + yauraFrame = 0.0f; } - var_f31 = temp_f31 - 1.0f; - if (var_f31 < 0.0f) { - var_f31 = 0.0f; + ymgcsFrame -= 1.0f; + if (ymgcsFrame < 0.0f) { + ymgcsFrame = 0.0f; } } - mYaura00rBrk.entryFrame(var_f28); - mYmgcs00Brk.entryFrame(var_f31); - if (var_f28 > 0.0f) { - f32 var_f31_2, var_f28_2; + mYaura00rBrk.entryFrame(yauraFrame); + mYmgcs00Brk.entryFrame(ymgcsFrame); + if (yauraFrame > 0.0f) { + f32 var_f28, var_f31; daPy_aura_c* auraEntry = mMagicArmorAuraEntries; if (dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e) && dComIfGp_getShipActor() != NULL) { - var_f31_2 = 0.0f; - var_f28_2 = 1.0f + (fabsf(dComIfGp_getShipActor()->speedF) / 15.0f); - if (var_f28_2 > 1.5f) { - var_f28_2 = 1.5f; + var_f31 = 0.0f; + var_f28 = 1.0f + (fabsf(dComIfGp_getShipActor()->speedF) / 15.0f); + if (var_f28 > 1.5f) { + var_f28 = 1.5f; } } else { - var_f31_2 = fabsf(mVelocity) / daPy_HIO_move_c0::m.field_0x18; - if (var_f31_2 > 1.0f) { - var_f31_2 = 1.0f; + var_f31 = fabsf(mVelocity) / daPy_HIO_move_c0::m.field_0x18; + if (var_f31 > 1.0f) { + var_f31 = 1.0f; } - var_f28_2 = 1.0f; + var_f28 = 1.0f; } - cXyz localScale = scale * (var_f28_2 * cM_fcos(M_PI * (0.5f * var_f31_2))); + cXyz localScale = scale * (var_f28 * cM_fcos(M_PI * (0.5f * var_f31))); for (int idx = 0; idx < (int)ARRAY_SIZE(mMagicArmorAuraEntries); idx++, auraEntry++) { f32 var_f0 = 1.0f + auraEntry->getFrame(); @@ -611,11 +608,11 @@ void daPy_lk_c::setAuraEffect() { auraEntry->getModel()->setBaseTRMtx(mpCLModel->getAnmMtx(aura_model_joint[idx])); if (idx == 0) { - auraEntry->getModel()->setBaseScale(scale * var_f31_2 * 1.2f); + auraEntry->getModel()->setBaseScale(scale * var_f31 * 1.2f); } else if (idx != 1) { auraEntry->getModel()->setBaseScale(localScale); } else { - auraEntry->getModel()->setBaseScale((scale * (1.0f - (0.3f * var_f31_2))) * 2.0f); + auraEntry->getModel()->setBaseScale((scale * (1.0f - (0.3f * var_f31))) * 2.0f); } } @@ -721,7 +718,6 @@ void daPy_lk_c::setWaterRipple() { local_4c.z = suimenMunyaMtx[2][3]; local_40.y = m35D0; - local_4c -= local_40; cXyz local_50; From d662cf6bd4e93b64aaa8242ed23aab96354b02e3 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 9 Aug 2024 18:38:43 +0200 Subject: [PATCH 28/30] Removed comment --- include/d/actor/d_a_player_main.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 6d23a3fe2..3f36a0d8c 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -80,7 +80,6 @@ class daPy_footEffect_c { dPa_smokeEcallBack* getSmokeCallBack() { return &mSmokeCb; } dPa_followEcallBack* getOtherCallBack() { return &mFollowCb; } - // Might be incorrect void setID(s32 id) { mId = id; } s32 getID() const { return mId; } void setAngle(csXyz* angle) { mAngle = *angle; } From 8566da624775633fc83eb62c30fe364398cfc1c1 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 9 Aug 2024 18:44:03 +0200 Subject: [PATCH 29/30] Removed another old comment --- include/d/actor/d_a_player_main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 3f36a0d8c..6f3ed1df4 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -275,7 +275,7 @@ class daPy_swBlur_c : public J3DPacket { /* 0x018 */ int field_0x018; /* 0x01C */ int mBlurColorType; /* 0x020 */ f32 mBlurTopRate; - /* 0x024 */ Vec* mpPosBuffer; // Pointer to tuple array? (could possibly use typedef for readability) + /* 0x024 */ Vec* mpPosBuffer; /* 0x028 */ cXyz field_0x028; /* 0x034 */ cXyz field_0x034[60]; /* 0x304 */ cXyz field_0x304[60]; From add3f115d1cd85f0f77c1f0360e66d57de13fc92 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:44:20 +0200 Subject: [PATCH 30/30] PR suggestions --- include/d/d_cc_d.h | 3 +- src/d/actor/d_a_player_particle.inc | 82 ++++++++--------------------- 2 files changed, 24 insertions(+), 61 deletions(-) diff --git a/include/d/d_cc_d.h b/include/d/d_cc_d.h index 193d603c1..92eb279cb 100644 --- a/include/d/d_cc_d.h +++ b/include/d/d_cc_d.h @@ -54,6 +54,7 @@ enum CcG_Tg_HitMark { enum dCcG_At_Spl { /* 0x0 */ dCcG_At_Spl_UNK0 = 0, /* 0x1 */ dCcG_At_Spl_UNK1 = 1, + /* 0x3 */ dCcG_At_Spl_UNK3 = 3, /* 0x6 */ dCcG_At_Spl_UNK6 = 6, /* 0x9 */ dCcG_At_Spl_UNK9 = 9, /* 0xB */ dCcG_At_Spl_UNKB = 0xB, @@ -486,4 +487,4 @@ class dCcD_Tri : public dCcD_GObjInf, public cCcD_TriAttr { dCcD_GObjInf* dCcD_GetGObjInf(cCcD_Obj* param_0); -#endif /* D_CC_D_CC_D_H */ \ No newline at end of file +#endif /* D_CC_D_CC_D_H */ diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 775d285cb..bf839b3f4 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -301,8 +301,8 @@ void daPy_swBlur_c::draw() { if (mBlurColorType == NORMAL_SLASH_BLUR) { // Normal color. - static GXColor n_color = {0xFF, 0xFF, 0xFF, 0x96}; - GXSetTevColor(GX_TEVREG0, n_color); + static GXColor n_color0 = {0xFF, 0xFF, 0xFF, 0x96}; + GXSetTevColor(GX_TEVREG0, n_color0); } else if (mBlurColorType == ELIXIR_SOUP_SLASH_BLUR) { // Elixir Soup color. static GXColor y_color0 = {0xFF, 0xFF, 0x7B, 0x96}; @@ -713,9 +713,7 @@ void daPy_lk_c::setWaterRipple() { MtxP suimenMunyaMtx = mpSuimenMunyaModel->getBaseTRMtx(); cXyz local_4c; - local_4c.x = suimenMunyaMtx[0][3]; - local_4c.y = suimenMunyaMtx[1][3]; - local_4c.z = suimenMunyaMtx[2][3]; + mDoMtx_multVecZero(suimenMunyaMtx, &local_4c); local_40.y = m35D0; local_4c -= local_40; @@ -737,9 +735,7 @@ void daPy_lk_c::setWaterRipple() { if (dPa_control_c::isStatus(0x01)) { MtxP mtx = mpCLModel->getAnmMtx(15); cXyz local_5c; - local_5c.x = mtx[0][3]; - local_5c.y = mtx[1][3]; - local_5c.z = mtx[2][3]; + mDoMtx_multVecZero(mtx, &local_5c); cXyz local_68; cMtx_multVec(mtx, &swim_side_offset, &local_68); @@ -785,11 +781,9 @@ void daPy_lk_c::setWaterRipple() { } if (m34CD == 0) { - MtxP mtx = mpCLModel->getAnmMtx(0); cXyz local_ac; - local_ac.x = mtx[0][3]; - local_ac.y = mtx[1][3]; - local_ac.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0), &local_ac); + dComIfGp_particle_setSingleRipple(0x3F, &local_ac, NULL, (cXyz*)&waterfall_ripple_scale); m34CD = 15; dComIfGp_getVibration().StartQuake(4, 1, cXyz(0.0f, 1.0f, 0.0f)); @@ -946,18 +940,12 @@ void daPy_lk_c::setFootEffect() { cXyz pos; if (getFootOnGround()) { if (getRightFootOnGround()) { - MtxP mtx = mpCLModel->getAnmMtx(0x27); - pos.x = mtx[0][3]; - pos.y = mtx[1][3]; - pos.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0x27), &pos); setFootMark(&pos); } if (getLeftFootOnGround()) { - MtxP mtx = mpCLModel->getAnmMtx(0x22); - pos.x = mtx[0][3]; - pos.y = mtx[1][3]; - pos.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0x22), &pos); setFootMark(&pos); } } @@ -1031,10 +1019,8 @@ void daPy_lk_c::setFootEffect() { if (mCurProc == daPyProc_DEMO_LAST_COMBO_e) { f32 rnd = cM_rndFX(17.5f); cXyz sp44 = m370C; - MtxP mtx = mpCLModel->getAnmMtx(0x1); - m370C.x = mtx[0][3]; - m370C.y = mtx[1][3]; - m370C.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0x1), &m370C); + if (m3570 != 0) { current.angle.y = shape_angle.y - 0x4000; m3570 = 0; @@ -1057,40 +1043,26 @@ void daPy_lk_c::setFootEffect() { } else if (m34BE == 3) { if (mCurrAttributeCode == dBgS_Attr_GRASS_e || mCurrAttributeCode == dBgS_Attr_WATER_e) { - MtxP mtx = mpCLModel->getAnmMtx(0x27); - pos.x = mtx[0][3]; - pos.y = mtx[1][3]; - pos.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0x27), &pos); setFootEffectType(temp_r3_4, &pos, 0, var_r29); - mtx = mpCLModel->getAnmMtx(0x22); - pos.x = mtx[0][3]; - pos.y = mtx[1][3]; - pos.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0x22), &pos); setFootEffectType(temp_r3_4, &pos, 1, var_r29); } else { setFootEffectType(temp_r3_4, ¤t.pos, 0, var_r29); } } else if (m34BE == 1) { - MtxP mtx = mpCLModel->getAnmMtx(0x22); - pos.x = mtx[0][3]; - pos.y = mtx[1][3]; - pos.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0x22), &pos); setFootEffectType(temp_r3_4, &pos, 0, var_r29); } else if (m34BE == 2) { - MtxP mtx = mpCLModel->getAnmMtx(0x27); - pos.x = mtx[0][3]; - pos.y = mtx[1][3]; - pos.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0x27), &pos); setFootEffectType(temp_r3_4, &pos, 0, var_r29); } else if (m34BE == 5) { setFootEffectType(temp_r3_4, ¤t.pos, 0, 1); } else if (m34BE == 6) { - MtxP mtx = mpCLModel->getAnmMtx(0); - pos.x = mtx[0][3]; - pos.y = mtx[1][3]; - pos.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0), &pos); + mGndChk.SetPos(&pos); @@ -1137,11 +1109,8 @@ void daPy_lk_c::setSwimTail() { /* 8012C2A4-8012C330 .text setCutWaterSplash__9daPy_lk_cFv */ void daPy_lk_c::setCutWaterSplash() { if (m336C.getEmitter() != NULL) { - MtxP mtx = mpCLModel->getAnmMtx(4); cXyz pos; - pos.x = mtx[0][3]; - pos.y = mtx[1][3]; - pos.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(4), &pos); dComIfGp_particle_setP1(0x39, &pos); } @@ -1173,15 +1142,10 @@ void daPy_lk_c::setSwimWaterDrop(daPy_waterDropEcallBack_c* callBack) { void daPy_lk_c::setWaterDrop() { MtxP mtx = mpCLModel->getAnmMtx(0x0E); cXyz tmp; - tmp.x = mtx[0][3]; - tmp.y = mtx[1][3]; - tmp.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0x0E), &tmp); m334C.setPos(&tmp); - mtx = mpCLModel->getAnmMtx(0x02); - tmp.x = mtx[0][3]; - tmp.y = mtx[1][3]; - tmp.z = mtx[2][3]; + mDoMtx_multVecZero(mpCLModel->getAnmMtx(0x02), &tmp); m336C.setPos(&tmp); if (checkModeFlg(ModeFlg_00000001)) { @@ -1282,9 +1246,9 @@ void daPy_lk_c::setDamageElecEmitter() { void daPy_lk_c::setDamageEmitter() { dCcD_GObjInf* tgHitGObj = mCyl.GetTgHitGObj(); if (tgHitGObj != NULL) { - if (tgHitGObj->GetAtSpl() == 0x3) { + if (tgHitGObj->GetAtSpl() == dCcG_At_Spl_UNK3) { setDamageCurseEmitter(); - } else if (tgHitGObj->GetAtSpl() == 0xB) { + } else if (tgHitGObj->GetAtSpl() == dCcG_At_Spl_UNKB) { setDamageElecEmitter(); } else if (tgHitGObj->ChkAtType(AT_TYPE_FIRE)) { setDamageFlameEmitter(); @@ -1299,9 +1263,7 @@ void daPy_lk_c::endFlameDamageEmitter() { if (current.pos.y < m35D0 - 10.0f) { for (int i = 0; i < (s32)ARRAY_SIZE(mDmEcallBack); i++) { cXyz pos; - pos.x = mDmEcallBack[i].mpMtx[0][3]; - pos.y = mDmEcallBack[i].mpMtx[1][3]; - pos.z = mDmEcallBack[i].mpMtx[2][3]; + mDoMtx_multVecZero(mDmEcallBack[i].mpMtx, &pos); pos.y = m35D0; dComIfGp_particle_set(0x35A, &pos);