The cause of this is the fact that Quake reuses entities; so if you gib a zombie, it will reuse the zombie entity but switch it's model to h_zombie. Of course, the old interpolation data for the zombie will reference pose numbers that the h_zombie model doesn't have, and so you'll have a stray pointer for a period of one frame until things settle back down. As Quake's memory is one big contiguous block, this won't matter too much - you'll just have some invalid data in there for that one frame (unless you're really tight on memory), but if you do any work on changing the memory system (such as to full dynamic with no limits) you'll begin to be bitten.
The fix is really simple, just find the CL_ParseUpdate function (in cl_parse.c), and look for the block starting "if (model != ent->model)". You'll want to add this code somewhere in the block:
Code: Select all
// if the model has changed we must also reset the interpolation data
// pose1 and pose2 are critical as they might be pointing to invalid frames in the new model!!!
ent->frame_start_time = 0;
ent->frame_interval = 0;
ent->pose1 = ent->pose2 = 0;
ent->translate_start_time = 0;
ent->origin1[0] = ent->origin1[1] = ent->origin1[2] = 0;
ent->origin2[0] = ent->origin2[1] = ent->origin2[2] = 0;
ent->rotate_start_time = 0;
ent->angles1[0] = ent->angles1[1] = ent->angles1[2] = 0;
ent->angles2[0] = ent->angles2[1] = ent->angles2[2] = 0;