[saco] Implement/match VectorNormaliseTo; casting the sum to double picks the fsqrt intrinsic instead of the float sqrt overload

This commit is contained in:
ricardoofnl
2026-09-04 22:27:13 +07:00
parent 783584be6e
commit cd7c129445
2 changed files with 12 additions and 0 deletions
+11
View File
@@ -793,6 +793,17 @@ void VectorCrossProduct(VECTOR *vecOut, VECTOR *vec1, VECTOR *vec2)
vecOut->Z = f1 - f2;
}
//----------------------------------------------------
void VectorNormaliseTo(VECTOR *vecOut, VECTOR *vecIn)
{
float fInv = 1.0f / (float)sqrt((double)(vecIn->X * vecIn->X + vecIn->Y * vecIn->Y +
vecIn->Z * vecIn->Z));
vecOut->X = fInv * vecIn->X;
vecOut->Y = fInv * vecIn->Y;
vecOut->Z = fInv * vecIn->Z;
}
//----------------------------------------------------
+1
View File
@@ -101,6 +101,7 @@ const char* GetTaskNameFromTask(DWORD *task);
int FUNC_100B4BC0(int a1, int a2, int a3); // .text:100B4BC0
float FastSqrt(float x); // .text:100B5A60
void VectorCrossProduct(VECTOR *vecOut, VECTOR *vec1, VECTOR *vec2); // .text:100B4C20
void VectorNormaliseTo(VECTOR *vecOut, VECTOR *vecIn); // .text:100B4CC0
void FUNC_100B5210(int a1, void *a2); // .text:100B5210, __cdecl: the caller's
// stack cleanup is folded into the next call's argument setup