diff --git a/src/g_main.c b/src/g_main.c index 01a9f47..6ce1271 100644 --- a/src/g_main.c +++ b/src/g_main.c @@ -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(); diff --git a/src/g_misc.c b/src/g_misc.c index 0d253ab..843ae3e 100644 --- a/src/g_misc.c +++ b/src/g_misc.c @@ -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); } diff --git a/src/header/local.h b/src/header/local.h index eb89805..b28d8d5 100644 --- a/src/header/local.h +++ b/src/header/local.h @@ -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