mirror of
https://github.com/yquake2/xatrix.git
synced 2024-11-10 06:42:22 +00:00
Don't crash when there is too much gibs or debris
This commit is contained in:
parent
8a29fa1c66
commit
9e03494cfb
1 changed files with 57 additions and 0 deletions
57
src/g_misc.c
57
src/g_misc.c
|
@ -2,6 +2,9 @@
|
|||
|
||||
#include "g_local.h"
|
||||
|
||||
int gibsthisframe = 0;
|
||||
int lastgibframe = 0;
|
||||
|
||||
|
||||
/*QUAKED func_group (0 0 0) ?
|
||||
Used to group brushes together just for editor convenience.
|
||||
|
@ -121,6 +124,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);
|
||||
|
@ -216,6 +237,24 @@ void ThrowGibACID (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);
|
||||
|
@ -381,6 +420,24 @@ void ThrowDebris (edict_t *self, char *modelname, float speed, vec3_t origin)
|
|||
edict_t *chunk;
|
||||
vec3_t v;
|
||||
|
||||
if (!self)
|
||||
{
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue