From 2a1410e072858cc2301ee26e0813941686278b7f Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Sat, 20 Jan 2024 20:49:47 -0500 Subject: [PATCH] documentation --- include/d/actor/d_a_npc_btsw2.h | 2 +- include/d/actor/d_a_npc_kamome.h | 1 - include/d/d_cc_uty.h | 16 ++++---- include/d/d_npc.h | 34 ++++++++-------- src/d/actor/d_a_npc_btsw2.cpp | 61 ++++++++++++++-------------- src/d/actor/d_a_npc_kamome.cpp | 4 +- src/d/actor/d_a_npc_md.cpp | 26 ++++++------ src/d/actor/d_a_rd.cpp | 30 +++++++------- src/d/d_cc_uty.cpp | 69 +++++++++++++++----------------- src/d/d_npc.cpp | 46 ++++++++++----------- 10 files changed, 143 insertions(+), 146 deletions(-) diff --git a/include/d/actor/d_a_npc_btsw2.h b/include/d/actor/d_a_npc_btsw2.h index 3e8379ce6..b3b1f3204 100644 --- a/include/d/actor/d_a_npc_btsw2.h +++ b/include/d/actor/d_a_npc_btsw2.h @@ -61,7 +61,7 @@ public: /* 0x710 */ u8 m710[0x714 - 0x710]; /* 0x714 */ csXyz m714; /* 0x71A */ u8 m71A[0x71D - 0x71A]; - /* 0x71D */ bool m71D; + /* 0x71D */ bool mHasAttention; /* 0x71E */ bool m71E; /* 0x71F */ u8 m71F[0x724 - 0x71F]; /* 0x724 */ u8 m724; diff --git a/include/d/actor/d_a_npc_kamome.h b/include/d/actor/d_a_npc_kamome.h index 18e1c546c..6ba016f21 100644 --- a/include/d/actor/d_a_npc_kamome.h +++ b/include/d/actor/d_a_npc_kamome.h @@ -31,7 +31,6 @@ public: /* 0x24 */ s16 mFlapDuration; /* 0x26 */ s16 mFlapExhaustedDuration; /* 0x28 */ s16 mFlapEnergyDuration; - /* 0x2A */ u8 field_2A[0x2C - 0x2A]; }; // Size: 0x2C class daNpc_kam_HIO_c : public JORReflexible { diff --git a/include/d/d_cc_uty.h b/include/d/d_cc_uty.h index d55f371e8..7ac394ac4 100644 --- a/include/d/d_cc_uty.h +++ b/include/d/d_cc_uty.h @@ -10,17 +10,15 @@ public: ~CcAtInfo() {} public: - /* 0x00 */ cCcD_Obj* mpObj; - /* 0x04 */ fopAc_ac_c* mpActor; + /* 0x00 */ cCcD_Obj* mpObj; // The attack obj + /* 0x04 */ fopAc_ac_c* mpActor; // The attacking actor /* 0x08 */ u8 mDamage; - /* 0x09 */ u8 mbDead; - /* 0x0A */ u8 mResultingAttackType; - /* 0x0B */ u8 m0B[0x0E - 0x0B]; - /* 0x0E */ s16 m0E; - /* 0x10 */ u8 m10[0x12 - 0x10]; + /* 0x09 */ bool mbDead; + /* 0x0A */ u8 mResultingAttackType; // TODO: Add enum for this + /* 0x0C */ csXyz m0C; /* 0x12 */ u16 mPlCutBit; /* 0x14 */ cXyz* pParticlePos; - /* 0x18 */ s32 mHitSoundId; + /* 0x18 */ s32 mHitSoundId; // TODO: Not sure what this is, argument passed to bgmHitSound }; int cc_pl_cut_bit_get(); @@ -31,4 +29,6 @@ void def_se_set_p(fopAc_ac_c*, cXyz*, cCcD_Obj*, unsigned long); fopAc_ac_c* at_power_check(CcAtInfo*); fopAc_ac_c* cc_at_check(fopAc_ac_c*, CcAtInfo*); +inline void dCc_GetAc(void*) {} + #endif /* D_CC_UTY_H */ diff --git a/include/d/d_npc.h b/include/d/d_npc.h index ebeaa38c1..5a39c46e5 100644 --- a/include/d/d_npc.h +++ b/include/d/d_npc.h @@ -16,21 +16,21 @@ public: public: /* 0x04 */ f32 m04; - /* 0x08 */ s16 m08; - /* 0x0A */ s16 m0A; - /* 0x0C */ s16 mMaxHeadRot; - /* 0x0E */ s16 mMaxBackBoneRot; - /* 0x10 */ s16 m10; - /* 0x12 */ s16 m12; - /* 0x14 */ s16 mMinHeadRot; - /* 0x16 */ s16 mMinBackBoneRot; - /* 0x18 */ s16 m18; - /* 0x1A */ s16 mMaxHeadTurnVel; - /* 0x1C */ f32 m1C; - /* 0x20 */ s16 m20; + /* 0x08 */ s16 mMaxHeadX; + /* 0x0A */ s16 mMaxBackboneX; + /* 0x0C */ s16 mMaxHeadY; + /* 0x0E */ s16 mMaxBackboneY; + /* 0x10 */ s16 mMinHeadX; + /* 0x12 */ s16 mMinBackboneX; + /* 0x14 */ s16 mMinHeadY; + /* 0x16 */ s16 mMinBackboneY; + /* 0x18 */ s16 mMaxTurnStep; + /* 0x1A */ s16 mMaxHeadTurnVel; // TODO: Not sure what the difference between this and the above field is + /* 0x1C */ f32 mAttnYOffset; + /* 0x20 */ s16 mMaxAttnAngleY; /* 0x22 */ u8 m22; /* 0x23 */ u8 m23[0x24 - 0x23]; - /* 0x24 */ f32 m24; + /* 0x24 */ f32 mMaxAttnDistXZ; }; class dNpc_JntCtrl_c { @@ -56,7 +56,7 @@ public: // /* 0x18 */ s16 mMaxHeadRot; // /* 0x1A */ s16 field_0x1A; // /* 0x1C */ s16 mMaxSpineRot; - /* 0x1E */ s16 field_0x1E[2][2]; + /* 0x1E */ s16 mMaxTurnStep[2][2]; /* 0x26 */ u8 pad_0x26[0x2C - 0x26]; /* 0x2C */ s16 field_0x2C; /* 0x2E */ s16 field_0x2E; @@ -93,8 +93,10 @@ public: void limitter(s16*, s16, s16); bool follow(s16*, s16, s16, int); bool move(s16, int); - void lookAtTarget(s16*, cXyz*, cXyz, s16, s16, bool); - void setParam(s16, s16, s16, s16, s16, s16, s16, s16, s16); + void lookAtTarget(s16* outY, cXyz* pDstPos, cXyz srcPos, s16 defaultY, s16 maxVel, bool param_6); + void setParam(s16 max_backbone_x, s16 max_backbone_y, s16 min_backbone_x, s16 min_backbone_y, + s16 max_head_x, s16 max_head_y, s16 min_head_x, s16 min_head_y, + s16 max_turn_step); int chkLim(s16, int, int); void turn_fromBackbone2Head(s16, s16*, s16*, bool); diff --git a/src/d/actor/d_a_npc_btsw2.cpp b/src/d/actor/d_a_npc_btsw2.cpp index c35007459..d0acac765 100644 --- a/src/d/actor/d_a_npc_btsw2.cpp +++ b/src/d/actor/d_a_npc_btsw2.cpp @@ -121,20 +121,20 @@ static dCcD_SrcCyl l_cyl_src = { /* 000000EC-000001A8 .text __ct__17daNpc_Btsw2_HIO_cFv */ daNpc_Btsw2_HIO_c::daNpc_Btsw2_HIO_c() { mNpc.m04 = 0.0f; - mNpc.m08 = 0x1F40; - mNpc.mMaxHeadRot = 0x1F40; - mNpc.m0A = 0x0; - mNpc.mMaxBackBoneRot = 0x1F40; - mNpc.m10 = -0xBB8; - mNpc.mMinHeadRot = -0x1F40; - mNpc.m12 = 0x0; - mNpc.mMinBackBoneRot = -0x1F40; - mNpc.m18 = 0x3E8; + mNpc.mMaxHeadX = 0x1F40; + mNpc.mMaxHeadY = 0x1F40; + mNpc.mMaxBackboneX = 0x0; + mNpc.mMaxBackboneY = 0x1F40; + mNpc.mMinHeadX = -0xBB8; + mNpc.mMinHeadY = -0x1F40; + mNpc.mMinBackboneX = 0x0; + mNpc.mMinBackboneY = -0x1F40; + mNpc.mMaxTurnStep = 0x3E8; mNpc.mMaxHeadTurnVel = 0x640; - mNpc.m1C = 40.0f; - mNpc.m20 = 0x2000; + mNpc.mAttnYOffset = 40.0f; + mNpc.mMaxAttnAngleY = 0x2000; mNpc.m22 = 0x0; - mNpc.m24 = 200.0f; + mNpc.mMaxAttnDistXZ = 200.0f; m30 = 0x258; m32 = 0x5; m34 = 0.8f; @@ -271,21 +271,22 @@ void daNpc_Btsw2_c::setAnm(s8 param_0) { } /* 0000067C-000007D0 .text chkAttention__13daNpc_Btsw2_cF4cXyzs */ -bool daNpc_Btsw2_c::chkAttention(cXyz pos, s16 r29) { +bool daNpc_Btsw2_c::chkAttention(cXyz pos, s16 facingAngleY) { fopAc_ac_c* player = dComIfGp_getPlayer(0); - f32 f30 = l_HIO.mNpc.m24; - int r30 = l_HIO.mNpc.m20; + f32 maxAttnDistXZ = l_HIO.mNpc.mMaxAttnDistXZ; + int maxAttnAngleY = l_HIO.mNpc.mMaxAttnAngleY; cXyz delta; delta.x = player->current.pos.x - pos.x; delta.z = player->current.pos.z - pos.z; - f32 f31 = sqrtf(delta.x*delta.x + delta.z*delta.z); - s16 r3 = cM_atan2s(delta.x, delta.z); - if (m71D) { - f30 += 40.0f; - r30 += 0x071C; + f32 distXZ = sqrtf(delta.x*delta.x + delta.z*delta.z); + s16 targetAngleY = cM_atan2s(delta.x, delta.z); + if (mHasAttention) { + // Increase the attention range when we're already looking at the player so it sticks slightly out of range. + maxAttnDistXZ += 40.0f; + maxAttnAngleY += cAngle::d2s(10.0f); } - r3 -= r29; - return r30 > abs(r3) && f30 > f31; + targetAngleY -= facingAngleY; + return maxAttnAngleY > abs(targetAngleY) && maxAttnDistXZ > distXZ; } /* 000007D0-00000820 .text eventOrder__13daNpc_Btsw2_cFv */ @@ -369,7 +370,7 @@ u16 daNpc_Btsw2_c::next_msgStatus(u32*) { /* 000009F4-00000A20 .text setAttention__13daNpc_Btsw2_cFv */ void daNpc_Btsw2_c::setAttention() { - mAttentionInfo.mPosition.set(m704.x, m704.y + l_HIO.mNpc.m1C, m704.z); + mAttentionInfo.mPosition.set(m704.x, m704.y + l_HIO.mNpc.mAttnYOffset, m704.z); } /* 00000A20-00000B94 .text lookBack__13daNpc_Btsw2_cFv */ @@ -387,13 +388,13 @@ void daNpc_Btsw2_c::lookBack() { if (m747 == 2) { r29 = false; m_jnt.setTrn(); - if (m71D == 0) { + if (!mHasAttention) { sp38 = dNpc_playerEyePos(l_HIO.mNpc.m04); s16 r4 = cLib_targetAngleY(¤t.pos, &sp38); cLib_addCalcAngleS2(¤t.angle.y, r4, 4, 0x1800); } } - if (m71D) { + if (mHasAttention) { sp38 = dNpc_playerEyePos(l_HIO.mNpc.m04); r31 = &sp38; sp2c = current.pos; @@ -572,8 +573,8 @@ BOOL daNpc_Btsw2_c::wait_action(void*) { m747 = 1; m74A++; } else if (m74A != -1) { - s16 angleY = current.angle.y + m_jnt.getHead_y() + m_jnt.getBackbone_y(); - m71D = chkAttention(current.pos, angleY); + s16 facingAngleY = current.angle.y + m_jnt.getHead_y() + m_jnt.getBackbone_y(); + mHasAttention = chkAttention(current.pos, facingAngleY); m746 = 0; switch (m747) { @@ -630,9 +631,9 @@ BOOL daNpc_Btsw2_c::_delete() { /* 00001C8C-00001DDC .text _execute__13daNpc_Btsw2_cFv */ BOOL daNpc_Btsw2_c::_execute() { m_jnt.setParam( - l_HIO.mNpc.m0A, l_HIO.mNpc.mMaxBackBoneRot, l_HIO.mNpc.m12, l_HIO.mNpc.mMinBackBoneRot, - l_HIO.mNpc.m08, l_HIO.mNpc.mMaxHeadRot, l_HIO.mNpc.m10, l_HIO.mNpc.mMinHeadRot, - l_HIO.mNpc.m18 + l_HIO.mNpc.mMaxBackboneX, l_HIO.mNpc.mMaxBackboneY, l_HIO.mNpc.mMinBackboneX, l_HIO.mNpc.mMinBackboneY, + l_HIO.mNpc.mMaxHeadX, l_HIO.mNpc.mMaxHeadY, l_HIO.mNpc.mMinHeadX, l_HIO.mNpc.mMinHeadY, + l_HIO.mNpc.mMaxTurnStep ); playTexPatternAnm(); mpMcaMorf->play(&mEyePos, 0, 0); diff --git a/src/d/actor/d_a_npc_kamome.cpp b/src/d/actor/d_a_npc_kamome.cpp index bff376257..31e253a17 100644 --- a/src/d/actor/d_a_npc_kamome.cpp +++ b/src/d/actor/d_a_npc_kamome.cpp @@ -166,8 +166,8 @@ int daNpc_kam_c::callDemoStartCheck() { } /* 0000052C-0000054C .text daNpc_kam_XyEventCB__FPvi */ -static s16 daNpc_kam_XyEventCB(void* i_this, int param_1) { - return ((daNpc_kam_c*)i_this)->XyEventCB(param_1); +static s16 daNpc_kam_XyEventCB(void* i_this, int equippedItemIdx) { + return ((daNpc_kam_c*)i_this)->XyEventCB(equippedItemIdx); } /* 0000054C-00000568 .text XyEventCB__11daNpc_kam_cFi */ diff --git a/src/d/actor/d_a_npc_md.cpp b/src/d/actor/d_a_npc_md.cpp index 513df5d66..b8cb56f72 100644 --- a/src/d/actor/d_a_npc_md.cpp +++ b/src/d/actor/d_a_npc_md.cpp @@ -229,20 +229,20 @@ daNpc_Md_HIO2_c::daNpc_Md_HIO2_c() { /* 00000274-00000574 .text __ct__14daNpc_Md_HIO_cFv */ daNpc_Md_HIO_c::daNpc_Md_HIO_c() { mNpc.m04 = -25.0f; - mNpc.m08 = 0x2328; - mNpc.mMaxHeadRot = 0x2328; - mNpc.m0A = 0x0; - mNpc.mMaxBackBoneRot = 0x1F40; - mNpc.m10 = -0x2328; - mNpc.mMinHeadRot = -0x2328; - mNpc.m12 = 0x0; - mNpc.mMinBackBoneRot = -0x1F40; - mNpc.m18 = 0x1000; + mNpc.mMaxHeadX = 0x2328; + mNpc.mMaxHeadY = 0x2328; + mNpc.mMaxBackboneX = 0x0; + mNpc.mMaxBackboneY = 0x1F40; + mNpc.mMinHeadX = -0x2328; + mNpc.mMinHeadY = -0x2328; + mNpc.mMinBackboneX = 0x0; + mNpc.mMinBackboneY = -0x1F40; + mNpc.mMaxTurnStep = 0x1000; mNpc.mMaxHeadTurnVel = 0x800; - mNpc.m1C = 130.0f; - mNpc.m20 = 0x4000; + mNpc.mAttnYOffset = 130.0f; + mNpc.mMaxAttnAngleY = 0x4000; mNpc.m22 = 0x0; - mNpc.m24 = 150.0f; + mNpc.mMaxAttnDistXZ = 150.0f; mpActor = NULL; m0B8 = 770.0f; m0BC = 250.0f; @@ -1445,7 +1445,7 @@ BOOL daNpc_Md_c::waitPlayerAction(void*) { shape_angle.y = current.angle.y; } s16 tempAngle = shape_angle.y; - mJntCtrl.lookAtTarget(&tempAngle, &stickPos, current.pos, shape_angle.y, l_HIO.mNpc.m18, false); + mJntCtrl.lookAtTarget(&tempAngle, &stickPos, current.pos, shape_angle.y, l_HIO.mNpc.mMaxTurnStep, false); if (temp > 0) { shape_angle.y = tempAngle; } diff --git a/src/d/actor/d_a_rd.cpp b/src/d/actor/d_a_rd.cpp index 0f0661a8d..b47693a99 100644 --- a/src/d/actor/d_a_rd.cpp +++ b/src/d/actor/d_a_rd.cpp @@ -123,20 +123,20 @@ daRd_HIO_c::daRd_HIO_c() { m52 = 0x96; mParalysisDuration = 2*30; mNpc.m04 = -20.0f; - mNpc.m08 = 0x1FFE; - mNpc.mMaxHeadRot = 0x4000; - mNpc.m0A = 0x0; - mNpc.mMaxBackBoneRot = 0x2000; - mNpc.m10 = -0x9C4; - mNpc.mMinHeadRot = -0x4000; - mNpc.m12 = 0x0; - mNpc.mMinBackBoneRot = -0x2000; - mNpc.m18 = 0x250; + mNpc.mMaxHeadX = 0x1FFE; + mNpc.mMaxHeadY = 0x4000; + mNpc.mMaxBackboneX = 0x0; + mNpc.mMaxBackboneY = 0x2000; + mNpc.mMinHeadX = -0x9C4; + mNpc.mMinHeadY = -0x4000; + mNpc.mMinBackboneX = 0x0; + mNpc.mMinBackboneY = -0x2000; + mNpc.mMaxTurnStep = 0x250; mNpc.mMaxHeadTurnVel = 0x150; - mNpc.m1C = 50.0f; - mNpc.m20 = 0x7FFF; + mNpc.mAttnYOffset = 50.0f; + mNpc.mMaxAttnAngleY = 0x7FFF; mNpc.m22 = 0x0; - mNpc.m24 = 400.0f; + mNpc.mMaxAttnDistXZ = 400.0f; } /* 0000027C-000002A8 .text searchNeadDeadRd_CB__FPvPv */ @@ -1672,9 +1672,9 @@ bool daRd_c::_execute() { } mJntCtrl.setParam( - l_HIO.mNpc.m0A, l_HIO.mNpc.mMaxBackBoneRot, l_HIO.mNpc.m12, l_HIO.mNpc.mMinBackBoneRot, - l_HIO.mNpc.m08, l_HIO.mNpc.mMaxHeadRot, l_HIO.mNpc.m10, l_HIO.mNpc.mMinHeadRot, - l_HIO.mNpc.m18 + l_HIO.mNpc.mMaxBackboneX, l_HIO.mNpc.mMaxBackboneY, l_HIO.mNpc.mMinBackboneX, l_HIO.mNpc.mMinBackboneY, + l_HIO.mNpc.mMaxHeadX, l_HIO.mNpc.mMaxHeadY, l_HIO.mNpc.mMinHeadX, l_HIO.mNpc.mMinHeadY, + l_HIO.mNpc.mMaxTurnStep ); if (mMode != MODE_PARALYSIS) { diff --git a/src/d/d_cc_uty.cpp b/src/d/d_cc_uty.cpp index 21e9bf406..493e67753 100644 --- a/src/d/d_cc_uty.cpp +++ b/src/d/d_cc_uty.cpp @@ -90,13 +90,8 @@ fopAc_ac_c* at_power_check(CcAtInfo* atInfo) { 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; + cCcD_Stts* stts = atInfo->mpObj->GetStts(); + atInfo->mpActor = stts == NULL ? NULL : stts->GetAc(); atInfo->mResultingAttackType = 0xC; atInfo->mDamage = 0; @@ -174,25 +169,25 @@ fopAc_ac_c* at_power_check(CcAtInfo* atInfo) { } } - atInfo->mbDead = 0; + atInfo->mbDead = false; if (fopAcM_GetName(atInfo->mpActor) == PROC_PLAYER) { dCcD_GObjInf* gObjInf = dCcD_GetGObjInf(atInfo->mpObj); if (gObjInf->GetAtSpl() == 1) { - atInfo->mbDead = 1; + atInfo->mbDead = true; } } else if (atInfo->mDamage >= 2) { - atInfo->mbDead = 1; + atInfo->mbDead = true; } return atInfo->mpActor; } /* 800AEEF8-800AF368 .text cc_at_check__FP10fopAc_ac_cP8CcAtInfo */ -fopAc_ac_c* cc_at_check(fopAc_ac_c* r30, CcAtInfo* atInfo) { +fopAc_ac_c* cc_at_check(fopAc_ac_c* tgActor, CcAtInfo* atInfo) { atInfo->mHitSoundId = 0; atInfo->mpActor = at_power_check(atInfo); - s8 r28; + s8 pauseTime; if (atInfo->mpActor) { mDoAud_onEnemyDamage(); @@ -202,34 +197,34 @@ fopAc_ac_c* cc_at_check(fopAc_ac_c* r30, CcAtInfo* atInfo) { 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; + f2 = tgActor->current.pos.x - atInfo->mpActor->current.pos.x; + f0 = tgActor->current.pos.z - atInfo->mpActor->current.pos.z; } - atInfo->m0E = cM_atan2s(-f2, -f0); + atInfo->m0C.y = 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)) { + if (fopAcM_checkStatus(tgActor, 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++; + if (fopAcM_GetName(atInfo->mpActor) == PROC_HIMO2 && tgActor->mStealItemLeft != 0) { + tgActor->mStealItemLeft--; + fopAcM_createStealItem(&tgActor->current.pos, tgActor->mItemTableIdx, tgActor->current.roomNo, NULL, tgActor->mStealItemBitNo); + tgActor->mStealItemBitNo++; atInfo->mDamage = 0; } if ((s8)atInfo->mDamage > 0) { - r30->mHealth -= atInfo->mDamage; + tgActor->mHealth -= atInfo->mDamage; } - if (r30->mHealth <= 0) { - atInfo->mbDead = 1; + if (tgActor->mHealth <= 0) { + atInfo->mbDead = true; - fopAcM_seStart(r30, JA_SE_LK_LAST_HIT, 0); + fopAcM_seStart(tgActor, JA_SE_LK_LAST_HIT, 0); - r28 = 6 + g_regHIO.mChild->mShortRegs[7]; + pauseTime = 6 + g_regHIO.mChild->mShortRegs[7]; if (atInfo->pParticlePos) { dComIfGp_particle_set(0x10, atInfo->pParticlePos); @@ -237,35 +232,35 @@ fopAc_ac_c* cc_at_check(fopAc_ac_c* r30, CcAtInfo* atInfo) { scale.x = scale.y = scale.z = 2.0f; csXyz angle; angle.x = angle.z = 0; - angle.y = fopAcM_searchPlayerAngleY(r30); + angle.y = fopAcM_searchPlayerAngleY(tgActor); dComIfGp_particle_set(dPa_name::ID_COMMON_NORMAL_HIT, atInfo->pParticlePos, &angle, &scale); } } else { - u32 r29 = fopAcM_GetName(r30) == PROC_ST ? 0x33 : 0x20; + u32 r29 = fopAcM_GetName(tgActor) == PROC_ST ? 0x33 : 0x20; if (atInfo->mbDead) { - fopAcM_seStart(r30, at_se_getC(atInfo->mpObj), r29); + fopAcM_seStart(tgActor, at_se_getC(atInfo->mpObj), r29); if (atInfo->mResultingAttackType == 9) { - r28 = 6; + pauseTime = 6; } else { - r28 = 4 + g_regHIO.mChild->mShortRegs[6]; + pauseTime = 4 + g_regHIO.mChild->mShortRegs[6]; } } else { - if (fopAcM_GetName(r30) == PROC_MT) { - mt_class* mt = (mt_class*)r30; + if (fopAcM_GetName(tgActor) == PROC_MT) { + mt_class* mt = (mt_class*)tgActor; if (mt->m454 == 2) { - fopAcM_seStart(r30, JA_SE_OBJ_MG_BALL_DMG, 0); + fopAcM_seStart(tgActor, JA_SE_OBJ_MG_BALL_DMG, 0); } else { - fopAcM_seStart(r30, at_se_get(atInfo->mpObj), r29); + fopAcM_seStart(tgActor, at_se_get(atInfo->mpObj), r29); } } else { - fopAcM_seStart(r30, at_se_get(atInfo->mpObj), r29); + fopAcM_seStart(tgActor, at_se_get(atInfo->mpObj), r29); } - r28 = 1 + g_regHIO.mChild->mShortRegs[5]; + pauseTime = 1 + g_regHIO.mChild->mShortRegs[5]; } } if (atInfo->mResultingAttackType == 1) { - dScnPly_ply_c::setPauseTimer(r28); + dScnPly_ply_c::setPauseTimer(pauseTime); } if (atInfo->mDamage != 0) { diff --git a/src/d/d_npc.cpp b/src/d/d_npc.cpp index daaac239d..264ed3ba9 100644 --- a/src/d/d_npc.cpp +++ b/src/d/d_npc.cpp @@ -81,12 +81,12 @@ bool dNpc_JntCtrl_c::move(s16 param_1, int param_2) { param_1 -= (int)angle; angles[i] = angle; angleL = mAngles[i][param_2]; - cLib_addCalcAngleL(&angleL, angle, 4, field_0x1E[i][param_2], 1); + cLib_addCalcAngleL(&angleL, angle, 4, mMaxTurnStep[i][param_2], 1); mAngles[i][param_2] = angleL; } for (i = 0, r25 = 0; i < 2; i++) { - if (cLib_distanceAngleS(angles[i], mAngles[i][param_2]) <= field_0x1E[i][param_2]/2) { + if (cLib_distanceAngleS(angles[i], mAngles[i][param_2]) <= mMaxTurnStep[i][param_2]/2) { r25++; } } @@ -129,22 +129,22 @@ void dNpc_JntCtrl_c::lookAtTarget(s16* outY, cXyz* pDstPos, cXyz srcPos, s16 def } /* 8021AC6C-8021ACA8 .text setParam__14dNpc_JntCtrl_cFsssssssss */ -void dNpc_JntCtrl_c::setParam(s16 param_1, s16 maxBackBoneRot, s16 param_3, s16 minBackBoneRot, - s16 param_5, s16 maxHeadRot, s16 param_7, s16 minHeadRot, - s16 param_9) +void dNpc_JntCtrl_c::setParam(s16 max_backbone_x, s16 max_backbone_y, s16 min_backbone_x, s16 min_backbone_y, + s16 max_head_x, s16 max_head_y, s16 min_head_x, s16 min_head_y, + s16 max_turn_step) { - mMaxAngles[1][0] = param_1; - mMaxAngles[1][1] = maxBackBoneRot; - mMinAngles[1][0] = param_3; - mMinAngles[1][1] = minBackBoneRot; - mMaxAngles[0][0] = param_5; - mMaxAngles[0][1] = maxHeadRot; - mMinAngles[0][0] = param_7; - mMinAngles[0][1] = minHeadRot; - field_0x1E[1][0] = param_9; - field_0x1E[1][1] = param_9; - field_0x1E[0][0] = param_9; - field_0x1E[0][1] = param_9; + mMaxAngles[1][0] = max_backbone_x; + mMaxAngles[1][1] = max_backbone_y; + mMinAngles[1][0] = min_backbone_x; + mMinAngles[1][1] = min_backbone_y; + mMaxAngles[0][0] = max_head_x; + mMaxAngles[0][1] = max_head_y; + mMinAngles[0][0] = min_head_x; + mMinAngles[0][1] = min_head_y; + mMaxTurnStep[1][0] = max_turn_step; + mMaxTurnStep[1][1] = max_turn_step; + mMaxTurnStep[0][0] = max_turn_step; + mMaxTurnStep[0][1] = max_turn_step; } /* 8021ACA8-8021ACBC .text setInfDrct__14dNpc_PathRun_cFP5dPath */ @@ -597,13 +597,13 @@ void dNpc_setShadowModel(J3DModel* param_1, J3DModelData* param_2, J3DModel* par } } -cXyz dNpc_playerEyePos(f32 param_1) { +cXyz dNpc_playerEyePos(f32 offsetY) { daPy_py_c* pPlayer = daPy_getPlayerActorClass(); cXyz pos = pPlayer->getHeadTopPos(); cXyz out; MtxTrans(pos.x, pos.y, pos.z, false); - pos.set(0.0f, param_1, 0.0f); + pos.set(0.0f, offsetY, 0.0f); MtxPosition(&pos, &out); out.x = pPlayer->current.pos.x; @@ -856,8 +856,8 @@ void dNpc_JntCtrl_c::lookAtTarget_2(s16* r26, cXyz* r29, cXyz r24, s16 r7, s16 r temp11 = field_0x32; r1_10 = mAngles[0][1]; r1_0C = mAngles[1][1]; - cLib_addCalcAngleL(&r1_10, temp10, 4, field_0x1E[0][0], 4); - cLib_addCalcAngleL(&r1_0C, temp11, 4, field_0x1E[0][0], 4); + cLib_addCalcAngleL(&r1_10, temp10, 4, mMaxTurnStep[0][0], 4); + cLib_addCalcAngleL(&r1_0C, temp11, 4, mMaxTurnStep[0][0], 4); mAngles[0][1] = r1_10; mAngles[1][1] = r1_0C; @@ -892,8 +892,8 @@ void dNpc_JntCtrl_c::lookAtTarget_2(s16* r26, cXyz* r29, cXyz r24, s16 r7, s16 r temp6 = field_0x30; r1_10 = mAngles[0][0]; r1_0C = mAngles[1][0]; - cLib_addCalcAngleL(&r1_10, temp7, 4, field_0x1E[0][0], 4); - cLib_addCalcAngleL(&r1_0C, temp6, 4, field_0x1E[0][0], 4); + cLib_addCalcAngleL(&r1_10, temp7, 4, mMaxTurnStep[0][0], 4); + cLib_addCalcAngleL(&r1_0C, temp6, 4, mMaxTurnStep[0][0], 4); mAngles[0][0] = r1_10; mAngles[1][0] = r1_0C; }