{
const matrix4x4_t *matrix;
matrix4x4_t blendmatrix, tempmatrix, matrix2;
- int j, k, l;
+ int j, k, l, frame;
float origin[3], angles[3], delta[3], lerp, d;
entity_t *t;
model_t *model;
e->render.colormap_shirtcolor[1] = cbcolor[1] * (1.0f / 255.0f);
e->render.colormap_shirtcolor[2] = cbcolor[2] * (1.0f / 255.0f);
}
- else if (e->state_current.colormap && cl.scores != NULL)
+ else if (e->state_current.colormap && cl.scores != NULL && e->state_current.colormap <= cl.maxclients)
{
int cb;
unsigned char *cbcolor;
}
// model setup and some modelflags
- if(e->state_current.modelindex < MAX_MODELS)
+ frame = e->state_current.frame;
+ if (e->state_current.modelindex < MAX_MODELS)
e->render.model = cl.model_precache[e->state_current.modelindex];
+ else
+ e->render.model = NULL;
if (e->render.model)
{
+ if (e->render.skinnum >= e->render.model->numskins)
+ e->render.skinnum = 0;
+ if (frame >= e->render.model->numframes)
+ frame = 0;
// models can set flags such as EF_ROCKET
// this 0xFF800000 mask is EF_NOMODELFLAGS plus all the higher EF_ flags such as EF_ROCKET
if (!(e->render.effects & 0xFF800000))
}
// animation lerp
- if (e->render.frame2 == e->state_current.frame)
+ if (e->render.frame2 == frame)
{
// update frame lerp fraction
e->render.framelerp = 1;
// begin a new frame lerp
e->render.frame1 = e->render.frame2;
e->render.frame1time = e->render.frame2time;
- e->render.frame2 = e->state_current.frame;
+ e->render.frame2 = frame;
e->render.frame2time = cl.time;
e->render.framelerp = 0;
}
if (s->modelindex >= MAX_MODELS)
Host_Error("CL_ValidateState: modelindex (%i) >= MAX_MODELS (%i)\n", s->modelindex, MAX_MODELS);
+ // these warnings are only warnings, no corrections are made to the state
+ // because states are often copied for decoding, which otherwise would
+ // propogate some of the corrections accidentally
+ // (this used to happen, sometimes affecting skin and frame)
+
// colormap is client index + 1
if ((!s->flags & RENDER_COLORMAPPED) && s->colormap > cl.maxclients)
- {
Con_DPrintf("CL_ValidateState: colormap (%i) > cl.maxclients (%i)\n", s->colormap, cl.maxclients);
- s->colormap = 0;
- }
model = cl.model_precache[s->modelindex];
if (model && model->type && s->frame >= model->numframes)
- {
Con_DPrintf("CL_ValidateState: no such frame %i in \"%s\" (which has %i frames)\n", s->frame, model->name, model->numframes);
- s->frame = 0;
- }
if (model && model->type && s->skin > 0 && s->skin >= model->numskins && !(s->lightpflags & PFLAGS_FULLDYNAMIC))
- {
Con_DPrintf("CL_ValidateState: no such skin %i in \"%s\" (which has %i skins)\n", s->skin, model->name, model->numskins);
- s->skin = 0;
- }
}
void CL_MoveLerpEntityStates(entity_t *ent)
{
float odelta[3], adelta[3];
- CL_ValidateState(&ent->state_current);
VectorSubtract(ent->state_current.origin, ent->persistent.neworigin, odelta);
VectorSubtract(ent->state_current.angles, ent->persistent.newangles, adelta);
if (!ent->state_previous.active || ent->state_previous.modelindex != ent->state_current.modelindex)