Add JntHit enums

This commit is contained in:
LagoLunatic
2025-08-15 20:27:31 -04:00
parent 0e661f8c6f
commit b4e022a336
10 changed files with 112 additions and 65 deletions
+21 -4
View File
@@ -5,6 +5,23 @@
#include "SSystem/SComponent/c_sxyz.h"
#include "JSystem/J3DGraphAnimator/J3DModel.h"
enum {
/* 0x0 */ JntHitType_CYL_e,
/* 0x1 */ JntHitType_SPH_e,
/* 0x2 */ JntHitType_CYL2_e,
/* 0x3 */ JntHitType_CYL_THROW_e,
/* 0x4 */ JntHitType_SPH_THROW_e,
/* 0x5 */ JntHitType_CYL_UNK_e, // Unused?
/* 0x6 */ JntHitType_SPH_UNK_e, // Unused?
/* 0x7 */ JntHitType_CYL_DELETE_e,
/* 0x8 */ JntHitType_SPH_DELETE_e,
};
enum {
JntHitIdx_DELETE_e = -3, // Hit a delete joint, so the actor should delete itself.
JntHitIdx_NONE_e = -1,
};
struct __jnt_hit_data_c {
public:
/* 0x0 */ s16 mShapeType;
@@ -34,25 +51,25 @@ public:
void setMdlPtr(J3DModel* model) { mpModel = model; }
void setMaxNum(s16 num) { mMaxNum = num; }
bool isThrow(int type) {
if (type == 4 || type == 3) {
if (type == JntHitType_SPH_THROW_e || type == JntHitType_CYL_THROW_e) {
return true;
}
return false;
}
bool isDelete(int type) {
if (type == 8 || type == 7) {
if (type == JntHitType_SPH_DELETE_e || type == JntHitType_CYL_DELETE_e) {
return true;
}
return false;
}
bool isCylinder(int type) {
if (type == 0 || type == 2 || type == 3 || type == 5 || type == 7) {
if (type == JntHitType_CYL_e || type == JntHitType_CYL2_e || type == JntHitType_CYL_THROW_e || type == JntHitType_CYL_UNK_e || type == JntHitType_CYL_DELETE_e) {
return true;
}
return false;
}
bool isSphere(int type) {
if (type == 1 || type == 4 || type == 6 || type == 8) {
if (type == JntHitType_SPH_e || type == JntHitType_SPH_THROW_e || type == JntHitType_SPH_UNK_e || type == JntHitType_SPH_DELETE_e) {
return true;
}
return false;
+1 -1
View File
@@ -1147,7 +1147,7 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) {
};
static __jnt_hit_data_c search_data[] = {
{
/* mShapeType */ 2, // Cylinder
/* mShapeType */ JntHitType_CYL2_e,
/* mJointIndex */ 0x05, // hitomi (pupil) joint
/* mRadius */ 5.0f,
/* mpOffsets */ cyl2_eye_offset,
+2 -2
View File
@@ -1238,13 +1238,13 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) {
};
static __jnt_hit_data_c search_data[] = {
{
/* mShapeType */ 2, // Cylinder
/* mShapeType */ JntHitType_CYL2_e,
/* mJointIndex */ 0x00, // body joint
/* mRadius */ 20.0f,
/* mpOffsets */ cyl_eye_offset,
},
{
/* mShapeType */ 1, // Sphere
/* mShapeType */ JntHitType_SPH_e,
/* mJointIndex */ 0x00, // body joint
/* mRadius */ 20.0f,
/* mpOffsets */ sph_offset,
+1 -1
View File
@@ -692,7 +692,7 @@ BOOL daArrow_c::procMove() {
field_0x6e6 = temp11;
field_0x618 = temp12;
hitType = 2; // Hit a joint
} else if (mHitJointIndex == -3) {
} else if (mHitJointIndex == JntHitIdx_DELETE_e) {
fopAcM_delete(this);
return TRUE;
}
+15 -15
View File
@@ -4625,91 +4625,91 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) {
};
static __jnt_hit_data_c search_data[] = {
{
/* mShapeType */ 1, // Sphere
/* mShapeType */ JntHitType_SPH_e,
/* mJointIndex */ 0x01, // hip1 joint
/* mRadius */ 20.0f,
/* mpOffsets */ hip_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x03, // momoL joint
/* mRadius */ 5.0f,
/* mpOffsets */ momo_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x04, // suneL1 joint
/* mRadius */ 2.5f,
/* mpOffsets */ sune_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x08, // momorR joint
/* mRadius */ 5.0f,
/* mpOffsets */ momo_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x09, // suneR1 joint
/* mRadius */ 2.5f,
/* mpOffsets */ sune_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x0C, // sippo1 joint
/* mRadius */ 3.0f,
/* mpOffsets */ shipo_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x0D, // sippo2 joint
/* mRadius */ 2.5f,
/* mpOffsets */ shipo_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x0E, // sippo3 joint
/* mRadius */ 1.5f,
/* mpOffsets */ shipo_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x0F, // sippo4 joint
/* mRadius */ 2.5f,
/* mpOffsets */ shipo_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x10, // mune joint
/* mRadius */ 20.0f,
/* mpOffsets */ mune1_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x10, // mune joint
/* mRadius */ 15.0f,
/* mpOffsets */ mune2_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x21, // udeL2 joint
/* mRadius */ 6.0f,
/* mpOffsets */ udeL_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x22, // udeL3 joint
/* mRadius */ 3.0f,
/* mpOffsets */ udeL_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x29, // udeR2 joint
/* mRadius */ 6.0f,
/* mpOffsets */ udeR_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x2A, // udeR3 joint
/* mRadius */ 3.0f,
/* mpOffsets */ udeR_offset,
+3 -3
View File
@@ -376,10 +376,10 @@ static BOOL daBridge_Draw(bridge_class* i_this) {
}
#ifdef __MWERKS__
i_this->mLineMat.update(i_this->m030C + 2, tmp, (GXColor){150, 150, 150, 255}, 0, &i_this->actor.tevStr);
i_this->mLineMat.update(i_this->m030C + 2, tmp, (GXColor){150, 150, 150, 255}, 0, &i_this->actor.tevStr);
#else
GXColor color = (GXColor){150, 150, 150, 255};
i_this->mLineMat.update(i_this->m030C + 2, tmp, color, 0, &i_this->actor.tevStr);
GXColor color = (GXColor){150, 150, 150, 255};
i_this->mLineMat.update(i_this->m030C + 2, tmp, color, 0, &i_this->actor.tevStr);
#endif
dComIfGd_set3DlineMat(&i_this->mLineMat);
}
+22 -22
View File
@@ -256,133 +256,133 @@ bool daRd_c::createArrowHeap() {
static Vec yubi_cyl_offset[] = {{0.0f, 0.0f, 0.0f}, {17.0f, 0.0f, 0.0f}};
static __jnt_hit_data_c search_data[] = {
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x01,
/* mRadius */ 4.0f,
/* mpOffsets */ kosi1_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x01,
/* mRadius */ 4.0f,
/* mpOffsets */ kosi2_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x01,
/* mRadius */ 4.0f,
/* mpOffsets */ kosi3_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x02,
/* mRadius */ 2.0f,
/* mpOffsets */ asi1_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x03,
/* mRadius */ 2.0f,
/* mpOffsets */ asi2_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x04,
/* mRadius */ 2.0f,
/* mpOffsets */ asi3_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x05,
/* mRadius */ 2.0f,
/* mpOffsets */ asi1_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x06,
/* mRadius */ 2.0f,
/* mpOffsets */ asi2_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x07,
/* mRadius */ 2.0f,
/* mpOffsets */ asi3_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x08,
/* mRadius */ 6.0f,
/* mpOffsets */ sebone_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x09,
/* mRadius */ 10.0f,
/* mpOffsets */ muneA_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x09,
/* mRadius */ 6.0f,
/* mpOffsets */ muneB1_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x09,
/* mRadius */ 6.0f,
/* mpOffsets */ muneB2_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x09,
/* mRadius */ 6.0f,
/* mpOffsets */ muneB3_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x0F,
/* mRadius */ 2.0f,
/* mpOffsets */ ude1_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x10,
/* mRadius */ 2.0f,
/* mpOffsets */ ude2_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x11,
/* mRadius */ 6.0f,
/* mpOffsets */ te_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x12,
/* mRadius */ 6.0f,
/* mpOffsets */ yubi_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x13,
/* mRadius */ 2.0f,
/* mpOffsets */ ude1_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x14,
/* mRadius */ 2.0f,
/* mpOffsets */ ude2_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x15,
/* mRadius */ 6.0f,
/* mpOffsets */ te_cyl_offset,
},
{
/* mShapeType */ 0, // Cylinder
/* mShapeType */ JntHitType_CYL_e,
/* mJointIndex */ 0x16,
/* mRadius */ 6.0f,
/* mpOffsets */ yubi_cyl_offset,
+18 -3
View File
@@ -222,9 +222,24 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) {
#if VERSION > VERSION_DEMO
static Vec sph_offset = {0.0f, 0.0f, 0.0f};
static __jnt_hit_data_c search_data[] = {
{8, 1, 140.0f, &sph_offset},
{8, 2, 90.0f, &sph_offset},
{8, 3, 50.0f, &sph_offset},
{
/* mShapeType */ JntHitType_SPH_DELETE_e,
/* mJointIndex */ 1,
/* mRadius */ 140.0f,
/* mpOffsets */ &sph_offset,
},
{
/* mShapeType */ JntHitType_SPH_DELETE_e,
/* mJointIndex */ 2,
/* mRadius */ 90.0f,
/* mpOffsets */ &sph_offset,
},
{
/* mShapeType */ JntHitType_SPH_DELETE_e,
/* mJointIndex */ 3,
/* mRadius */ 50.0f,
/* mpOffsets */ &sph_offset,
},
};
i_this->m924 = JntHit_create(i_this->mpMorf->getModel(), search_data, ARRAY_SIZE(search_data));
+18 -3
View File
@@ -297,9 +297,24 @@ static BOOL useHeapInit(fopAc_ac_c* a_this) {
#if VERSION > VERSION_DEMO
static Vec sph_offset = {0.0f, 0.0f, 0.0f};
static __jnt_hit_data_c search_data[] = {
{8, 1, 50.0f, &sph_offset},
{8, 2, 30.0f, &sph_offset},
{8, 3, 20.0f, &sph_offset},
{
/* mShapeType */ JntHitType_SPH_DELETE_e,
/* mJointIndex */ 1,
/* mRadius */ 50.0f,
/* mpOffsets */ &sph_offset,
},
{
/* mShapeType */ JntHitType_SPH_DELETE_e,
/* mJointIndex */ 2,
/* mRadius */ 30.0f,
/* mpOffsets */ &sph_offset,
},
{
/* mShapeType */ JntHitType_SPH_DELETE_e,
/* mJointIndex */ 3,
/* mRadius */ 20.0f,
/* mpOffsets */ &sph_offset,
},
};
i_this->m708 = JntHit_create(i_this->mpMorf1->getModel(), search_data, ARRAY_SIZE(search_data));
+11 -11
View File
@@ -260,7 +260,7 @@ s32 JntHit_c::searchJntHitPosAngleOffset(cXyz* r18, csXyz* r28, cXyz* r29, csXyz
J3DModel* model = mpModel;
f32 f31 = 10000.0f;
int j = 0;
int jointIndex = -1;
int jointIndex = JntHitIdx_NONE_e;
s16* pShapeType = mpShapeTypes;
s16* pJointIndex = mpJointIndexes;
f32* pRadius = mpRadiuses;
@@ -269,7 +269,7 @@ s32 JntHit_c::searchJntHitPosAngleOffset(cXyz* r18, csXyz* r28, cXyz* r29, csXyz
int posIndex = 0;
int hitIndex = 0;
int hitPosIndex = 0;
int r1_20 = -1;
int r1_20 = JntHitIdx_NONE_e;
for (; j++ < mMaxNum; i++) {
mDoMtx_stack_c::copy(model->getAnmMtx(*pJointIndex));
@@ -316,13 +316,13 @@ s32 JntHit_c::searchJntHitPosAngleOffset(cXyz* r18, csXyz* r28, cXyz* r29, csXyz
hitPosIndex = posIndex;
if (cLib_IsZero(f5) && cLib_IsZero(f29)) {
if (!isThrow(*pShapeType)) {
if (*pShapeType == 0) {
if (*pShapeType == JntHitType_CYL_e) {
CylHitPosAngleOffset(&r1_1A0, r28, r29, r30, r1_17C, r1_170, *pRadius);
} else if (*pShapeType == 2) {
} else if (*pShapeType == JntHitType_CYL2_e) {
Cyl2HitPosAngleOffset(&r1_1A0, r28, r29, r30, r1_17C, r1_170, *pRadius);
}
if (isDelete(*pShapeType)) {
return -3;
return JntHitIdx_DELETE_e;
}
if (HitBufferUpdate(&r1_20, &r1_194, jointIndex, r28, r29)) {
r1_188 = *r29;
@@ -346,7 +346,7 @@ s32 JntHit_c::searchJntHitPosAngleOffset(cXyz* r18, csXyz* r28, cXyz* r29, csXyz
if (cLib_IsZero(f31)) {
SphHitPosAngleOffset(&r1_1A0, r28, r29, r30, r1_140, *pRadius);
if (isDelete(*pShapeType)) {
jointIndex = -3;
jointIndex = JntHitIdx_DELETE_e;
return jointIndex;
} else if (isThrow(*pShapeType)) {
// Do nothing
@@ -377,19 +377,19 @@ s32 JntHit_c::searchJntHitPosAngleOffset(cXyz* r18, csXyz* r28, cXyz* r29, csXyz
mDoMtx_stack_c::copy(model->getAnmMtx(jointIndex));
if (isThrow(pShapeType[hitIndex])) {
jointIndex = -1;
jointIndex = JntHitIdx_NONE_e;
} else if (isDelete(pShapeType[hitIndex])) {
jointIndex = -3;
} else if (pShapeType[hitIndex] == 0) {
jointIndex = JntHitIdx_DELETE_e;
} else if (pShapeType[hitIndex] == JntHitType_CYL_e) {
mDoMtx_stack_c::multVec(&pOffset[hitPosIndex], &r1_134);
mDoMtx_stack_c::multVec(&pOffset[hitPosIndex+1], &r1_128);
r1_1A0 = *r18 - r1_134;
CylHitPosAngleOffset(&r1_1A0, r28, r29, r30, r1_134, r1_128, pRadius[hitIndex]);
} else if (pShapeType[hitIndex] == 1) {
} else if (pShapeType[hitIndex] == JntHitType_SPH_e) {
mDoMtx_stack_c::multVec(&pOffset[hitPosIndex], &r1_11C);
r1_1A0 = *r18 - r1_11C;
SphHitPosAngleOffset(&r1_1A0, r28, r29, r30, r1_11C, pRadius[hitIndex]);
} else {
} else { // JntHitType_CYL2_e
mDoMtx_stack_c::multVec(&pOffset[hitPosIndex], &r1_110);
mDoMtx_stack_c::multVec(&pOffset[hitPosIndex+1], &r1_104);
r1_1A0 = *r18 - r1_110;