Code:
stock void VectorRotate(float vec[3], const float matrix[3][3])
{
vec[0] = GetVectorDotProduct(vec, matrix[0]);
vec[1] = GetVectorDotProduct(vec, matrix[1]);
vec[2] = GetVectorDotProduct(vec, matrix[2]);
}
This is fundamentally wrong. You are using already rotated vector values when rotating in next axes.
The rotation matrix values don't seem to be correct either.
Basically, you shouldn't use this .inc file, unless you want to face bugs that are really hard to debug.