Fix the crash when too much debris or gib is thrown

This commit is contained in:
Yamagi Burmeister 2011-10-11 07:58:53 +00:00
parent 5acee518b5
commit 4e31aed406

View file

@ -2,6 +2,9 @@
#include "g_local.h"
int gibsthisframe = 0;
int lastgibframe = 0;
extern void M_WorldEffects (edict_t *ent);
/*QUAKED func_group (0 0 0) ?
@ -122,6 +125,24 @@ void ThrowGib (edict_t *self, char *gibname, int damage, int type)
vec3_t size;
float vscale;
if (!self || !gibname)
{
return;
}
if (level.framenum > lastgibframe)
{
gibsthisframe = 0;
lastgibframe = level.framenum;
}
gibsthisframe++;
if (gibsthisframe > 20)
{
return;
}
gib = G_Spawn();
VectorScale (self->size, 0.5, size);
@ -274,6 +295,24 @@ void ThrowDebris (edict_t *self, char *modelname, float speed, vec3_t origin)
edict_t *chunk;
vec3_t v;
if (!self || !modelname)
{
return;
}
if (level.framenum > lastgibframe)
{
gibsthisframe = 0;
lastgibframe = level.framenum;
}
gibsthisframe++;
if (gibsthisframe > 20)
{
return;
}
chunk = G_Spawn();
VectorCopy (origin, chunk->s.origin);
gi.setmodel (chunk, modelname);