diff --git a/saco/game/util.cpp b/saco/game/util.cpp index 0fe9e56..3c0a06b 100644 --- a/saco/game/util.cpp +++ b/saco/game/util.cpp @@ -2041,3 +2041,19 @@ void FUNC_100B5480(float *pQuatOut, float *pQuatFrom, float *pQuatTo, float fT) pQuatOut[2] = qOut.y; pQuatOut[3] = qOut.z; } + +//----------------------------------------------------------- + +void FUNC_100B5620(float *pQuat, float *pEuler) +{ + float f0 = pQuat[0] * pQuat[0]; + float f1 = pQuat[1] * pQuat[1]; + float f2 = pQuat[2] * pQuat[2]; + float f3 = pQuat[3] * pQuat[3]; + + pEuler[0] = (float)atan2((pQuat[2] * pQuat[1] + pQuat[3] * pQuat[0]) * 2.0f, + f1 - f2 - f3 + f0); + pEuler[1] = (float)asin((pQuat[3] * pQuat[1] - pQuat[2] * pQuat[0]) * -2.0f); + pEuler[2] = (float)atan2((pQuat[3] * pQuat[2] + pQuat[1] * pQuat[0]) * 2.0f, + f3 - (f2 + f1) + f0); +} diff --git a/saco/game/util.h b/saco/game/util.h index 0af6428..252aeb7 100644 --- a/saco/game/util.h +++ b/saco/game/util.h @@ -168,6 +168,7 @@ void FUNC_100B57E0(int a1, int nIndex, int a3, int a4); // .text:100B57E0 void FUNC_100B5790(int a1, int nIndex, int a3); // .text:100B5790 void FUNC_100B5740(int a1, int a2); // .text:100B5740 void FUNC_100B5830(int a1, int nIndex, float *pfOut); // .text:100B5830 +void FUNC_100B5620(float *pQuat, float *pEuler); // .text:100B5620 void FUNC_100B5210(int a1, void *a2); // .text:100B5210, __cdecl: the caller's // stack cleanup is folded into the next call's argument setup