Reset gibsthisframe and lastgibframe at map change

Without this change the conditionals at g_misc.c:199 and 381 wouldn't
trigger until level.framenum reach it's previous value, resulting in
much to few debris or gibs being thrown. This fixes #104.

Many thanks to maraakate for the analysis and the idea how to fix it.
This commit is contained in:
Yamagi Burmeister 2015-10-24 13:30:41 +02:00
parent ef8882e106
commit 291d9852ee
3 changed files with 21 additions and 15 deletions

View File

@ -380,6 +380,9 @@ ExitLevel(void)
ent->health = ent->client->pers.max_health; ent->health = ent->client->pers.max_health;
} }
} }
gibsthisframe = 0;
lastgibframe = 0;
} }
/* /*

View File

@ -7,8 +7,8 @@
#include "header/local.h" #include "header/local.h"
int gibsthisframe = 0; int gibsthisframe;
int lastgibframe = 0; int lastgibframe;
/* /*
* QUAKED func_group (0 0 0) ? * QUAKED func_group (0 0 0) ?
@ -244,7 +244,7 @@ ThrowHead(edict_t *self, char *gibname, int damage, int type)
{ {
return; return;
} }
self->s.skinnum = 0; self->s.skinnum = 0;
self->s.frame = 0; self->s.frame = 0;
VectorClear(self->mins); VectorClear(self->mins);
@ -368,7 +368,7 @@ ThrowHeadACID(edict_t *self, char *gibname, int damage, int type)
{ {
return; return;
} }
self->s.skinnum = 0; self->s.skinnum = 0;
self->s.frame = 0; self->s.frame = 0;
VectorClear(self->mins); VectorClear(self->mins);

View File

@ -249,12 +249,12 @@ typedef struct
{ {
char helpmessage1[512]; char helpmessage1[512];
char helpmessage2[512]; char helpmessage2[512];
int helpchanged; /* flash F1 icon if non 0, play sound int helpchanged; /* flash F1 icon if non 0, play sound
and increment only if 1, 2, or 3 */ and increment only if 1, 2, or 3 */
gclient_t *clients; /* [maxclients] */ gclient_t *clients; /* [maxclients] */
/* can't store spawnpoint in level, because /* can't store spawnpoint in level, because
it would get overwritten by the savegame restore */ it would get overwritten by the savegame restore */
char spawnpoint[512]; /* needed for coop respawns */ char spawnpoint[512]; /* needed for coop respawns */
@ -428,6 +428,9 @@ extern spawn_temp_t st;
extern int sm_meat_index; extern int sm_meat_index;
extern int snd_fry; extern int snd_fry;
extern int gibsthisframe;
extern int lastgibframe;
/* means of death */ /* means of death */
#define MOD_UNKNOWN 0 #define MOD_UNKNOWN 0
#define MOD_BLASTER 1 #define MOD_BLASTER 1
@ -525,14 +528,14 @@ extern cvar_t *sv_maplist;
/* item spawnflags */ /* item spawnflags */
#define ITEM_TRIGGER_SPAWN 0x00000001 #define ITEM_TRIGGER_SPAWN 0x00000001
#define ITEM_NO_TOUCH 0x00000002 #define ITEM_NO_TOUCH 0x00000002
/* 6 bits reserved for editor flags /* 6 bits reserved for editor flags
8 bits used as power cube id bits 8 bits used as power cube id bits
for coop games */ for coop games */
#define DROPPED_ITEM 0x00010000 #define DROPPED_ITEM 0x00010000
#define DROPPED_PLAYER_ITEM 0x00020000 #define DROPPED_PLAYER_ITEM 0x00020000
#define ITEM_TARGETS_USED 0x00040000 #define ITEM_TARGETS_USED 0x00040000
/* fields are needed for spawning from the /* fields are needed for spawning from the
entity string and saving / loading games */ entity string and saving / loading games */
#define FFL_SPAWNTEMP 1 #define FFL_SPAWNTEMP 1
#define FFL_NOSPAWN 2 #define FFL_NOSPAWN 2
@ -806,7 +809,7 @@ typedef struct
qboolean connected; /* a loadgame will leave valid entities that qboolean connected; /* a loadgame will leave valid entities that
just don't have a connection yet */ just don't have a connection yet */
/* values saved and restored from /* values saved and restored from
edicts when changing levels */ edicts when changing levels */
int health; int health;
int max_health; int max_health;
@ -848,8 +851,8 @@ typedef struct
qboolean spectator; /* client is a spectator */ qboolean spectator; /* client is a spectator */
} client_respawn_t; } client_respawn_t;
/* this structure is cleared on each /* this structure is cleared on each
PutClientInServer(), except for PutClientInServer(), except for
'client->pers' */ 'client->pers' */
struct gclient_s struct gclient_s
{ {
@ -877,7 +880,7 @@ struct gclient_s
gitem_t *newweapon; gitem_t *newweapon;
/* sum up damage over an entire frame, so /* sum up damage over an entire frame, so
shotgun blasts give a single big kick */ shotgun blasts give a single big kick */
int damage_armor; /* damage absorbed by armor */ int damage_armor; /* damage absorbed by armor */
int damage_parmor; /* damage absorbed by power armor */ int damage_parmor; /* damage absorbed by power armor */
@ -943,9 +946,9 @@ struct edict_s
{ {
entity_state_t s; entity_state_t s;
struct gclient_s *client; /* NULL if not a player */ struct gclient_s *client; /* NULL if not a player */
/* the server expects the first part /* the server expects the first part
of gclient_s to be a player_state_t of gclient_s to be a player_state_t
but the rest of it is opaque */ but the rest of it is opaque */
qboolean inuse; qboolean inuse;
@ -1003,7 +1006,7 @@ struct edict_s
vec3_t avelocity; vec3_t avelocity;
int mass; int mass;
float air_finished; float air_finished;
float gravity; /* per entity gravity multiplier (1.0 is float gravity; /* per entity gravity multiplier (1.0 is
normal) use for lowgrav artifact, flares */ normal) use for lowgrav artifact, flares */
edict_t *goalentity; edict_t *goalentity;