Let's see... well, I guess the first step would be to stop the function modifying the other VECTORs -- only the ANGLE should be modified, and I wonder if re-using the same vectors over and over again after they've been modified has something to do with the problem.
function alignToVec(ANGLE* entAng, VECTOR* vec, VECTOR* axis, var factor) {
VECTOR locVec, locAxis;
vec_set(locVec, vec);
vec_set(locAxis, axis);
vec_rotate(locAxis, entAng);
vec_normalize(locAxis, 1);
vec_normalize(locVec, 1);
VECTOR rotAxis;
vec_cross(rotAxis, locVec, locAxis);
//USE ONLY ONE OF THE FOLLOWING TWO LINES!!!!!!!
//var angle = -acos((float)vec_dot(locAxis, locVec)) * factor; // instant rotation
var angle = -acos((float)vec_dot(locAxis, locVec)) * factor * vec_length(rotAxis); //smooth rotation
ANGLE rotAngle;
ang_for_axis(rotAngle, rotAxis, angle);
ang_add(entAng, rotAngle);
}
The next thing I would try is to make sure we're passing the correct information -- alignToVec(&V_Ang, &V_Nrml, vector(0, 0, 1), 1);
We add in the "&" to make sure we're passing a pointer to those parameters -- something Lite-C normally does automatically, but under occasional circumstances it won't. If the wrong address is being passed, V_Ang won't get modified, and we get the behaviour we've been seeing.
Fingers crossed!