don't bug out so much on skeletal models when frametimes are negative (can happen via csqc)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5226 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2018-03-23 06:35:32 +00:00
parent cfa28262b4
commit 93624e9d62
3 changed files with 11 additions and 8 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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)