diff --git a/engine/common/com_mesh.c b/engine/common/com_mesh.c index 448d7d7dd..f8f3f3928 100644 --- a/engine/common/com_mesh.c +++ b/engine/common/com_mesh.c @@ -1004,8 +1004,8 @@ typedef struct } skellerps_t; static qboolean Alias_BuildSkelLerps(skellerps_t *lerps, struct framestateregion_s *fs, int numbones, galiasinfo_t *inf) { - unsigned int frame1; - unsigned int frame2; + int frame1; //signed, because frametime might be negative... + int frame2; float mlerp; //minor lerp, poses within a group. int l = 0; galiasanimation_t *g; @@ -1042,18 +1042,22 @@ static qboolean Alias_BuildSkelLerps(skellerps_t *lerps, struct framestateregion } mlerp = time*g->rate; - frame1=mlerp; + frame1=floor(mlerp); frame2=frame1+1; mlerp-=frame1; if (g->loop) { //loop normally. frame1=frame1%g->numposes; frame2=frame2%g->numposes; + if (frame1 < 0) + frame1 += g->numposes; + if (frame2 < 0) + frame2 += g->numposes; } else { - frame1=(frame1>g->numposes-1)?g->numposes-1:frame1; - frame2=(frame2>g->numposes-1)?g->numposes-1:frame2; + frame1=bound(0, frame1, g->numposes-1); + frame2=bound(0, frame2, g->numposes-1); } if (lerps->skeltype == SKEL_IDENTITY) diff --git a/engine/common/mathlib.c b/engine/common/mathlib.c index 996b0c56b..c05012eb1 100644 --- a/engine/common/mathlib.c +++ b/engine/common/mathlib.c @@ -1895,10 +1895,9 @@ vec_t QDECL VectorNormalize2 (const vec3_t v, vec3_t out) float length, ilength; length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - + length = sqrt (length); if (length) { - length = sqrt (length); // FIXME ilength = 1/length; out[0] = v[0]*ilength; out[1] = v[1]*ilength; diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index c7f6689ae..bed989551 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -1726,7 +1726,7 @@ void R_GAlias_GenerateBatches(entity_t *e, batch_t **batches) continue; skin = skin?skin:NULL; shader = e->forcedshader?e->forcedshader:regshader; - if (shader) + if (shader && !(shader->flags & SHADER_NODRAW)) { b = BE_GetTempBatch(); if (!b)