Skip to content

Commit

Permalink
lara-hair: simplify pointer usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rr- committed Aug 30, 2024
1 parent 9ddc3a2 commit 641824b
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/game/lara/lara_hair.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ void Lara_Hair_Control(void)
// hips
Matrix_Push_I();
objptr = mesh_base[LM_HIPS];
Matrix_TranslateRel_I(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel_I(objptr[0], objptr[1], objptr[2]);
Matrix_Interpolate();
sphere[0].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[0].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[0].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[0].r = (int32_t) * (objptr + 3);
sphere[0].r = objptr[3];
Matrix_Pop_I();

// torso
Expand All @@ -160,12 +160,12 @@ void Lara_Hair_Control(void)
g_Lara.interp.result.torso_rot.z);
Matrix_Push_I();
objptr = g_Meshes[object->mesh_index + LM_TORSO]; // ignore shotgun
Matrix_TranslateRel_I(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel_I(objptr[0], objptr[1], objptr[2]);
Matrix_Interpolate();
sphere[1].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[1].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[1].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[1].r = (int32_t) * (objptr + 3);
sphere[1].r = objptr[3];
Matrix_Pop_I();

// right arm
Expand All @@ -175,12 +175,12 @@ void Lara_Hair_Control(void)
Matrix_RotYXZpack_I(
packed_rotation1[LM_UARM_R], packed_rotation2[LM_UARM_R]);
objptr = mesh_base[LM_UARM_R];
Matrix_TranslateRel_I(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel_I(objptr[0], objptr[1], objptr[2]);
Matrix_Interpolate();
sphere[3].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[3].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[3].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[3].r = (int32_t) * (objptr + 3) * 3 / 2;
sphere[3].r = (int32_t)objptr[3] * 3 / 2;
Matrix_Pop_I();

// left arm
Expand All @@ -190,12 +190,12 @@ void Lara_Hair_Control(void)
Matrix_RotYXZpack_I(
packed_rotation1[LM_UARM_L], packed_rotation2[LM_UARM_L]);
objptr = mesh_base[LM_UARM_L];
Matrix_TranslateRel_I(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel_I(objptr[0], objptr[1], objptr[2]);
Matrix_Interpolate();
sphere[4].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[4].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[4].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[4].r = (int32_t) * (objptr + 3) * 3 / 2;
sphere[4].r = (int32_t)objptr[3] * 3 / 2;
Matrix_Pop_I();

// head
Expand All @@ -208,12 +208,12 @@ void Lara_Hair_Control(void)
g_Lara.interp.result.head_rot.z);
Matrix_Push_I();
objptr = mesh_base[LM_HEAD];
Matrix_TranslateRel_I(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel_I(objptr[0], objptr[1], objptr[2]);
Matrix_Interpolate();
sphere[2].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[2].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[2].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[2].r = (int32_t) * (objptr + 3);
sphere[2].r = objptr[3];
Matrix_Pop_I();

Matrix_TranslateRel_I(HAIR_OFFSET_X, HAIR_OFFSET_Y, HAIR_OFFSET_Z);
Expand All @@ -227,11 +227,11 @@ void Lara_Hair_Control(void)
// hips
Matrix_Push();
objptr = mesh_base[LM_HIPS];
Matrix_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel(objptr[0], objptr[1], objptr[2]);
sphere[0].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[0].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[0].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[0].r = (int32_t) * (objptr + 3);
sphere[0].r = objptr[3];
Matrix_Pop();

// torso
Expand All @@ -243,11 +243,11 @@ void Lara_Hair_Control(void)
g_Lara.interp.result.torso_rot.z);
Matrix_Push();
objptr = g_Meshes[object->mesh_index + LM_TORSO]; // ignore shotgun
Matrix_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel(objptr[0], objptr[1], objptr[2]);
sphere[1].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[1].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[1].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[1].r = (int32_t) * (objptr + 3);
sphere[1].r = objptr[3];
Matrix_Pop();

// right arm
Expand All @@ -256,11 +256,11 @@ void Lara_Hair_Control(void)
*(bone + 1 + 28), *(bone + 2 + 28), *(bone + 3 + 28));
Matrix_RotYXZpack(packed_rotation[LM_UARM_R]);
objptr = mesh_base[LM_UARM_R];
Matrix_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel(objptr[0], objptr[1], objptr[2]);
sphere[3].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[3].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[3].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[3].r = (int32_t) * (objptr + 3) * 3 / 2;
sphere[3].r = (int32_t)objptr[3] * 3 / 2;
Matrix_Pop();

// left arm
Expand All @@ -269,11 +269,11 @@ void Lara_Hair_Control(void)
*(bone + 1 + 40), *(bone + 2 + 40), *(bone + 3 + 40));
Matrix_RotYXZpack(packed_rotation[LM_UARM_L]);
objptr = mesh_base[LM_UARM_L];
Matrix_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel(objptr[0], objptr[1], objptr[2]);
sphere[4].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[4].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[4].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[4].r = (int32_t) * (objptr + 3) * 3 / 2;
sphere[4].r = (int32_t)objptr[3] * 3 / 2;
Matrix_Pop();

// head
Expand All @@ -285,11 +285,11 @@ void Lara_Hair_Control(void)
g_Lara.interp.result.head_rot.z);
Matrix_Push();
objptr = mesh_base[LM_HEAD];
Matrix_TranslateRel(*objptr, *(objptr + 1), *(objptr + 2));
Matrix_TranslateRel(objptr[0], objptr[1], objptr[2]);
sphere[2].x = g_MatrixPtr->_03 >> W2V_SHIFT;
sphere[2].y = g_MatrixPtr->_13 >> W2V_SHIFT;
sphere[2].z = g_MatrixPtr->_23 >> W2V_SHIFT;
sphere[2].r = (int32_t) * (objptr + 3);
sphere[2].r = objptr[3];
Matrix_Pop();

Matrix_TranslateRel(HAIR_OFFSET_X, HAIR_OFFSET_Y, HAIR_OFFSET_Z);
Expand Down

0 comments on commit 641824b

Please sign in to comment.