Index: code/renderer/tr_model_iqm.c =================================================================== --- code/renderer/tr_model_iqm.c (revision 2013) +++ code/renderer/tr_model_iqm.c (working copy) @@ -401,23 +401,26 @@ LL( pose->channelscale[8] ); } - // check and swap model bounds - if(IQM_CheckRange(header, header->ofs_bounds, - header->num_frames, sizeof(*bounds))) + if (header->ofs_bounds) { - return qfalse; - } - bounds = (iqmBounds_t *) ((byte *) header + header->ofs_bounds); - for(i = 0; i < header->num_poses; i++) - { - LL(bounds->bbmin[0]); - LL(bounds->bbmin[1]); - LL(bounds->bbmin[2]); - LL(bounds->bbmax[0]); - LL(bounds->bbmax[1]); - LL(bounds->bbmax[2]); + // check and swap model bounds + if(IQM_CheckRange(header, header->ofs_bounds, + header->num_frames, sizeof(*bounds))) + { + return qfalse; + } + bounds = (iqmBounds_t *) ((byte *) header + header->ofs_bounds); + for(i = 0; i < header->num_frames; i++) + { + LL(bounds->bbmin[0]); + LL(bounds->bbmin[1]); + LL(bounds->bbmin[2]); + LL(bounds->bbmax[0]); + LL(bounds->bbmax[1]); + LL(bounds->bbmax[2]); - bounds++; + bounds++; + } } // allocate the model and copy the data @@ -677,6 +680,11 @@ vec_t *oldBounds, *newBounds; int i; + if (!data->bounds) { + tr.pc.c_box_cull_md3_clip++; + return CULL_CLIP; + } + // compute bounds pointers oldBounds = data->bounds + 6*ent->e.oldframe; newBounds = data->bounds + 6*ent->e.frame; @@ -712,6 +720,7 @@ int i, j; fog_t *fog; vec_t *bounds; + const vec_t defaultBounds[6] = { -8, -8, -8, 8, 8, 8 }; vec3_t diag, center; vec3_t localOrigin; vec_t radius; @@ -721,7 +730,11 @@ } // FIXME: non-normalized axis issues - bounds = data->bounds + 6*ent->e.frame; + if (data->bounds) { + bounds = data->bounds + 6*ent->e.frame; + } else { + bounds = defaultBounds; + } VectorSubtract( bounds+3, bounds, diag ); VectorMA( bounds, 0.5f, diag, center ); VectorAdd( ent->e.origin, center, localOrigin );