trying to make it a little more robust for omc
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4337 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
b7db01e3fc
commit
186dd8ab68
1 changed files with 107 additions and 92 deletions
|
@ -2016,16 +2016,8 @@ qboolean Cull_Traceline(edict_t *viewer, edict_t *seen)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_WritePlayersToClient
|
||||
|
||||
=============
|
||||
*/
|
||||
void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *clent, qbyte *pvs, sizebuf_t *msg)
|
||||
void SV_WritePlayersToMVD (client_t *client, client_frame_t *frame, sizebuf_t *msg)
|
||||
{
|
||||
qboolean isbot;
|
||||
int j;
|
||||
client_t *cl;
|
||||
edict_t *ent, *vent;
|
||||
|
@ -2036,14 +2028,6 @@ void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *
|
|||
#define DF_DEAD (1<<8)
|
||||
#define DF_GIB (1<<9)
|
||||
|
||||
if (client->state < cs_spawned && pvs)
|
||||
{
|
||||
Con_Printf("SV_WritePlayersToClient: not spawned yet\n", client->namebuf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (clent == NULL) //write to demo file. (no PVS)
|
||||
{
|
||||
demo_frame = &demo.frames[demo.parsecount&DEMO_FRAMES_MASK];
|
||||
for (j=0,cl=svs.clients, dcl = demo_frame->clients; j<MAX_CLIENTS ; j++,cl++, dcl++)
|
||||
{
|
||||
|
@ -2059,9 +2043,6 @@ void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *
|
|||
#endif
|
||||
|
||||
ent = cl->edict;
|
||||
if (cl->viewent && ent == clent)
|
||||
vent = EDICT_NUM(svprogfuncs, cl->viewent);
|
||||
else
|
||||
vent = ent;
|
||||
|
||||
if (progstype != PROG_QW)
|
||||
|
@ -2118,13 +2099,29 @@ void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *
|
|||
dcl->flags |= DF_DEAD;
|
||||
if (ent->v->mins[2] != -24)
|
||||
dcl->flags |= DF_GIB;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_WritePlayersToClient
|
||||
|
||||
=============
|
||||
*/
|
||||
void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *clent, qbyte *pvs, sizebuf_t *msg)
|
||||
{
|
||||
qboolean isbot;
|
||||
int j;
|
||||
client_t *cl;
|
||||
edict_t *ent, *vent;
|
||||
// int pflags;
|
||||
|
||||
if (client->state < cs_spawned)
|
||||
{
|
||||
Con_Printf("SV_WritePlayersToClient: not spawned yet\n", client->namebuf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef NQPROT
|
||||
if (!ISQWCLIENT(client))
|
||||
return;
|
||||
|
@ -2306,7 +2303,7 @@ void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *
|
|||
continue;
|
||||
|
||||
// ignore if not touching a PV leaf
|
||||
if (!sv.world.worldmodel->funcs.EdictInFatPVS(sv.world.worldmodel, &((wedict_t*)ent)->pvsinfo, pvs))
|
||||
if (!sv.world.worldmodel->funcs.EdictInFatPVS(sv.world.worldmodel, &ent->pvsinfo, pvs))
|
||||
continue;
|
||||
|
||||
if (!((int)clent->xv->dimension_see & ((int)ent->xv->dimension_seen | (int)ent->xv->dimension_ghost)))
|
||||
|
@ -2379,7 +2376,20 @@ void SV_WritePlayersToClient (client_t *client, client_frame_t *frame, edict_t *
|
|||
clst.spectator = 0;
|
||||
if (client->spectator)
|
||||
{
|
||||
if (client->spec_track)
|
||||
client_t *s;
|
||||
|
||||
if (client->spec_track > 0 && client->spec_track <= sv.allocated_client_slots)
|
||||
s = &svs.clients[client->spec_track-1];
|
||||
else if (client->spec_track || !s->state != cs_spawned)
|
||||
{
|
||||
Con_Printf("Client was spectating now-invalid entity: %i\n", client->spec_track);
|
||||
client->spec_track = 0;
|
||||
s = NULL;
|
||||
}
|
||||
else
|
||||
s = NULL;
|
||||
|
||||
if (s)
|
||||
{
|
||||
clst.spectator = 2;
|
||||
clst.mins = svs.clients[client->spec_track-1].edict->v->mins;
|
||||
|
@ -3503,7 +3513,12 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
|
|||
|
||||
// send over the players in the PVS
|
||||
if (svs.gametype != GT_HALFLIFE)
|
||||
{
|
||||
if (client == &demo.recorder)
|
||||
SV_WritePlayersToMVD(client, frame, msg);
|
||||
else
|
||||
SV_WritePlayersToClient (client, frame, clent, pvs, msg);
|
||||
}
|
||||
|
||||
SVQW_EmitPacketEntities (client, pack, msg);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue