d_jnt_hit progress

This commit is contained in:
LagoLunatic
2023-10-20 14:11:21 -04:00
parent 273221a500
commit 7f796fffa8
3 changed files with 101 additions and 15 deletions
+43 -10
View File
@@ -8,19 +8,19 @@
struct __jnt_hit_data_c {
public:
/* 0x0 */ s16 field_0x0;
/* 0x0 */ s16 mShapeType;
/* 0x2 */ s16 mJointIndex;
/* 0x4 */ f32 field_0x4;
/* 0x8 */ cXyz* field_0x8;
/* 0x4 */ f32 mRadius;
/* 0x8 */ cXyz* mpOffsets;
};
class JntHit_c {
public:
JntHit_c()
: mpModel(NULL)
, field_0x08(NULL)
, field_0x0C(NULL)
, field_0x10(NULL)
, mpOffsets(NULL)
, mpRadiuses(NULL)
, mpShapeTypes(NULL)
, field_0x1C(NULL) {}
BOOL CreateInit();
@@ -31,13 +31,34 @@ public:
s32 searchJntHitPosAngleOffset(cXyz*, csXyz*, cXyz*, csXyz*);
J3DModel* getModel() { return mpModel; }
// setSearchData(__jnt_hit_data_c*);
// setMdlPtr(J3DModel*);
// setMaxNum(short);
// isThrow(int);
// isDelete(int);
bool isCylinder(int type) {
if (type == 0 || (u32)type-2 <= 1 || type == 5 || type == 7) {
return true;
}
return false;
}
bool isSphere(int type) {
if (type == 1 || type == 4 || type == 6 || type == 8) {
return true;
}
return false;
}
// DBdraw(JntHit_HIO_c&);
// DBdrawCyl(MtxP, cXyz*, cXyz*, f32);
// DBdrawSph(MtxP, cXyz*, f32);
// DBdrawAll();
/* 0x00 */ __jnt_hit_data_c* mpHitData;
/* 0x04 */ J3DModel* mpModel;
/* 0x08 */ cXyz* field_0x08;
/* 0x0C */ short* field_0x0C;
/* 0x10 */ short* field_0x10;
/* 0x14 */ short* mpJointIndexes;
/* 0x08 */ cXyz* mpOffsets;
/* 0x0C */ f32* mpRadiuses;
/* 0x10 */ s16* mpShapeTypes;
/* 0x14 */ s16* mpJointIndexes;
/* 0x18 */ s16 mHitDataCount;
/* 0x1A */ u8 field_0x1A[2];
/* 0x1C */ void* field_0x1C;
@@ -47,6 +68,18 @@ class JntHit_HIO_c {
public:
JntHit_HIO_c();
virtual ~JntHit_HIO_c();
public:
/* 0x04 */ s8 mChildID;
/* 0x05 */ u8 m05[0x06 - 0x05];
/* 0x06 */ s16 m06;
/* 0x08 */ s16 m08;
/* 0x0A */ u8 m0A[0x0C - 0x0A];
/* 0x0C */ f32 m0C;
/* 0x10 */ cXyz m10;
/* 0x1C */ f32 m1C;
/* 0x20 */ f32 m20;
/* 0x24 */ f32 m24;
};
JntHit_c* JntHit_create(J3DModel* model, __jnt_hit_data_c* jntHitData, s16 hitDataCount);
+3 -3
View File
@@ -1209,10 +1209,10 @@ static BOOL useHeapInit(fopAc_ac_c* i_actor) {
};
static __jnt_hit_data_c search_data[] = {
{
/* field_0x0 */ 2,
/* mShapeType */ 2, // Cylinder
/* mJointIndex */ 0x05, // hitomi (pupil) joint
/* field_0x4 */ 5.0f,
/* field_0x8 */ (cXyz*)&cyl2_eye_offset,
/* mRadius */ 5.0f,
/* mpOffsets */ (cXyz*)&cyl2_eye_offset,
},
};
i_this->mEyeJntHit = JntHit_create(i_this->mpMorf->getModel(), search_data, ARRAY_SIZE(search_data));
+55 -2
View File
@@ -8,12 +8,65 @@
/* 80060BE8-80060C44 .text __ct__12JntHit_HIO_cFv */
JntHit_HIO_c::JntHit_HIO_c() {
/* Nonmatching */
m06 = 0;
m08 = 0;
m0C = 50.0f;
m10.set(cXyz::Zero);
m1C = 0.0f;
m20 = 0.0f;
m24 = 100.0f;
mChildID = -1;
}
/* 80060C44-80060EC4 .text CreateInit__8JntHit_cFv */
BOOL JntHit_c::CreateInit() {
/* Nonmatching */
__jnt_hit_data_c* pHitData = mpHitData;
int posCount = 0;
int i;
for (i = 0; i < mHitDataCount; i++) {
if (isCylinder(pHitData->mShapeType)) {
posCount += 2;
} else if (isSphere(pHitData->mShapeType)) {
posCount += 1;
}
pHitData++;
}
mpShapeTypes = new s16[mHitDataCount];
mpOffsets = new cXyz[posCount];
mpRadiuses = new f32[mHitDataCount];
mpJointIndexes = new s16[mHitDataCount];
if (!mpShapeTypes || !mpOffsets || !mpRadiuses || !mpJointIndexes) {
return FALSE;
}
pHitData = mpHitData;
s16* pShapeType = mpShapeTypes;
s16* pJointIndex = mpJointIndexes;
f32* pRadius = mpRadiuses;
cXyz* pOffset = mpOffsets;
for (i = 0; i < mHitDataCount;) {
pShapeType[0] = pHitData->mShapeType;
pJointIndex[0] = pHitData->mJointIndex;
pRadius[0] = pHitData->mRadius;
if (isCylinder(pShapeType[0])) {
pOffset[0] = pHitData->mpOffsets[0];
pOffset[1] = pHitData->mpOffsets[1];
pOffset++;
} else if (isSphere(pShapeType[0])) {
pOffset[0] = pHitData->mpOffsets[0];
}
pOffset++;
i++;
pHitData++;
pShapeType++;
pJointIndex++;
pRadius++;
}
return TRUE;
}
/* 80060EC4-80061440 .text CylHitPosAngleOffset__8JntHit_cFP4cXyzP5csXyzP4cXyzP5csXyz4cXyz4cXyzf */