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:03:23 +02:00
parent c620cea34b
commit ed4e94510d
3 changed files with 14 additions and 17 deletions

View file

@ -400,8 +400,8 @@ ExitLevel(void)
}
}
debristhisframe = 0;
gibsthisframe = 0;
lastgibframe = 0;
}
/*
@ -416,6 +416,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

@ -178,15 +178,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;
}
@ -205,6 +199,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)
{
@ -358,15 +353,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;
}
@ -390,6 +379,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

@ -105,6 +105,10 @@ typedef enum
AMMO_PROX
} ammo_t;
/* Maximum debris / gibs per frame */
#define MAX_GIBS 20
#define MAX_DEBRIS 20
/* deadflag */
#define DEAD_NO 0
#define DEAD_DYING 1
@ -501,8 +505,8 @@ extern int jacket_armor_index;
extern int combat_armor_index;
extern int body_armor_index;
extern int debristhisframe;
extern int gibsthisframe;
extern int lastgibframe;
/* means of death */
#define MOD_UNKNOWN 0