{
// ! means this is not sent to client
0,//double time; // ! time this state was built (used on client for interpolation)
+ {0,0,0},//float netcenter[3]; // ! for network prioritization, this is the center of the bounding box (which may differ from the origin)
{0,0,0},//float origin[3];
{0,0,0},//float angles[3];
0,//int number; // entity number this state is for
0,//unsigned char tagindex;
{32, 32, 32},//unsigned char colormod[3];
// padding to a multiple of 8 bytes (to align the double time)
- {0,0,0,0,0,0}//unsigned char unused[6]; // !
+ {0,0}//unsigned char unused[2]; // !
};
// LordHavoc: I own protocol ranges 96, 97, 3500-3599
Con_DPrintf("Protocol: Runaway loop recursing tagentity links on entity %i\n", stateindex);
// now that we have the parent entity we can make some decisions based on
// distance from the player
- if (VectorDistance(d->states[d->viewentnum].origin, s->origin) < 1024.0f)
+ if (VectorDistance(d->states[d->viewentnum].netcenter, s->netcenter) < 1024.0f)
priority++;
return bound(1, priority, E5_PROTOCOL_PRIORITYLEVELS - 1);
}
#define RENDER_SHADOW 65536 // cast shadow
#define RENDER_LIGHT 131072 // receive light
-// this is 88 bytes
+// this is 96 bytes
typedef struct entity_state_s
{
// ! means this is not sent to client
double time; // ! time this state was built (used on client for interpolation)
+ float netcenter[3]; // ! for network prioritization, this is the center of the bounding box (which may differ from the origin)
float origin[3];
float angles[3];
int number; // entity number this state is for
unsigned char tagindex;
unsigned char colormod[3];
// padding to a multiple of 8 bytes (to align the double time)
- unsigned char unused[6];
+ unsigned char unused[2];
}
entity_state_t;
cullmaxs[1] = max(cullmaxs[1], cs->origin[1] + specialvisibilityradius);
cullmaxs[2] = max(cullmaxs[2], cs->origin[2] + specialvisibilityradius);
}
+ // calculate center of bbox for network prioritization purposes
+ VectorMAM(0.5f, cullmins, 0.5f, cullmaxs, cs->netcenter);
+ // if culling box has moved, update pvs cluster links
if (!VectorCompare(cullmins, ent->priv.server->cullmins) || !VectorCompare(cullmaxs, ent->priv.server->cullmaxs))
{
VectorCopy(cullmins, ent->priv.server->cullmins);
VectorCopy(cullmaxs, ent->priv.server->cullmaxs);
+ // a value of -1 for pvs_numclusters indicates that the links are not
+ // cached, and should be re-tested each time, this is the case if the
+ // culling box touches too many pvs clusters to store, or if the world
+ // model does not support FindBoxClusters
ent->priv.server->pvs_numclusters = -1;
if (sv.worldmodel && sv.worldmodel->brush.FindBoxClusters)
{