Split the gibs per frame limit between gibs and debris.

The gibs and debris per frame must be limited to prevent server mem
map overflows. Until now debris and gibs were handled the same, the
debris spawned by rockets and grenates could prevent the actual gibs
of the killed monster from spawning.

Before this change 20 entities were spawned at max. Now up tp 40
enties can be spawned. This needs some testings.
This commit is contained in:
Yamagi Burmeister 2018-10-07 12:13:48 +02:00
parent 57c80dccf7
commit eb0c7a3cb5
3 changed files with 16 additions and 24 deletions

View file

@ -381,8 +381,8 @@ ExitLevel(void)
}
}
debristhisframe = 0;
gibsthisframe = 0;
lastgibframe = 0;
}
/*
@ -397,6 +397,9 @@ G_RunFrame(void)
level.framenum++;
level.time = level.framenum * FRAMETIME;
debristhisframe = 0;
gibsthisframe = 0;
/* choose a client for monsters to target this frame */
AI_SetSightClient();

View file

@ -181,15 +181,9 @@ ThrowGib(edict_t *self, char *gibname, int damage, int type)
return;
}
if (level.framenum > lastgibframe)
{
gibsthisframe = 0;
lastgibframe = level.framenum;
}
gibsthisframe++;
if (gibsthisframe > 20)
if (gibsthisframe > MAX_GIBS)
{
return;
}
@ -208,6 +202,7 @@ ThrowGib(edict_t *self, char *gibname, int damage, int type)
gib->flags |= FL_NO_KNOCKBACK;
gib->takedamage = DAMAGE_YES;
gib->die = gib_die;
gib->health = 250;
if (type == GIB_ORGANIC)
{
@ -299,15 +294,9 @@ ThrowGibACID(edict_t *self, char *gibname, int damage, int type)
return;
}
if (level.framenum > lastgibframe)
{
gibsthisframe = 0;
lastgibframe = level.framenum;
}
gibsthisframe++;
if (gibsthisframe > 20)
if (gibsthisframe > MAX_GIBS)
{
return;
}
@ -333,6 +322,7 @@ ThrowGibACID(edict_t *self, char *gibname, int damage, int type)
gib->takedamage = DAMAGE_YES;
gib->die = gib_die;
gib->dmg = 2;
gib->health = 250;
if (type == GIB_ORGANIC)
{
@ -488,15 +478,9 @@ ThrowDebris(edict_t *self, char *modelname, float speed, vec3_t origin)
return;
}
if (level.framenum > lastgibframe)
{
gibsthisframe = 0;
lastgibframe = level.framenum;
}
debristhisframe++;
gibsthisframe++;
if (gibsthisframe > 20)
if (debristhisframe > MAX_DEBRIS)
{
return;
}
@ -520,6 +504,7 @@ ThrowDebris(edict_t *self, char *modelname, float speed, vec3_t origin)
chunk->classname = "debris";
chunk->takedamage = DAMAGE_YES;
chunk->die = debris_die;
chunk->health = 250;
gi.linkentity(chunk);
}

View file

@ -92,6 +92,10 @@ typedef enum
AMMO_TRAP
} ammo_t;
/* Maximum debris / gibs per frame */
#define MAX_GIBS 20
#define MAX_DEBRIS 20
/* deadflag */
#define DEAD_NO 0
#define DEAD_DYING 1
@ -428,8 +432,8 @@ extern spawn_temp_t st;
extern int sm_meat_index;
extern int snd_fry;
extern int debristhisframe;
extern int gibsthisframe;
extern int lastgibframe;
/* means of death */
#define MOD_UNKNOWN 0