void Protocol_Names(char *buffer, size_t buffersize);
// model effects
-#define EF_ROCKET 1 // leave a trail
-#define EF_GRENADE 2 // leave a trail
-#define EF_GIB 4 // leave a trail
-#define EF_ROTATE 8 // rotate (bonus items)
-#define EF_TRACER 16 // green split trail
-#define EF_ZOMGIB 32 // small blood trail
-#define EF_TRACER2 64 // orange split trail + rotate
-#define EF_TRACER3 128 // purple trail
+#define MF_ROCKET 1 // leave a trail
+#define MF_GRENADE 2 // leave a trail
+#define MF_GIB 4 // leave a trail
+#define MF_ROTATE 8 // rotate (bonus items)
+#define MF_TRACER 16 // green split trail
+#define MF_ZOMGIB 32 // small blood trail
+#define MF_TRACER2 64 // orange split trail + rotate
+#define MF_TRACER3 128 // purple trail
+
// entity effects
#define EF_BRIGHTFIELD 1
#define EF_MUZZLEFLASH 2
#define EF_ADDITIVE 32
#define EF_BLUE 64
#define EF_RED 128
-#define EF_DELTA 8388608 // LordHavoc: (obsolete) entity is delta compressed to save network bandwidth (no longer used)
-#define EF_LOWPRECISION 4194304 // LordHavoc: entity is low precision (integer coordinates) to save network bandwidth
-// effects/model (can be used as model flags or entity effects)
-#define EF_REFLECTIVE 256 // LordHavoc: shiny metal objects :) (not currently supported)
-#define EF_FULLBRIGHT 512 // LordHavoc: fullbright
-#define EF_FLAME 1024 // LordHavoc: on fire
-#define EF_STARDUST 2048 // LordHavoc: showering sparks
-#define EF_NOSHADOW 4096 // LordHavoc: does not cast a shadow
-#define EF_NODEPTHTEST 8192 // LordHavoc: shows through walls
-#define EF_SELECTABLE 16384 // LordHavoc: highlights when PRYDON_CLIENTCURSOR mouse is over it
-#define EF_DOUBLESIDED 32768 //[515]: disable cull face for this entity
-
-#define EF_FLAG1QW 16777216 // internal client use only
-#define EF_FLAG2QW 33554432 // internal client use only
-#define EF_STEP 0x80000000 // internal client use only - present on MOVETYPE_STEP entities, not QC accessible (too many bits)
+#define EF_UNUSED8 256
+#define EF_FULLBRIGHT 512 // LordHavoc: fullbright
+#define EF_FLAME 1024 // LordHavoc: on fire
+#define EF_STARDUST 2048 // LordHavoc: showering sparks
+#define EF_NOSHADOW 4096 // LordHavoc: does not cast a shadow
+#define EF_NODEPTHTEST 8192 // LordHavoc: shows through walls
+#define EF_SELECTABLE 16384 // LordHavoc: highlights when PRYDON_CLIENTCURSOR mouse is over it
+#define EF_DOUBLESIDED 32768 //[515]: disable cull face for this entity
+#define EF_UNUSED16 65536
+#define EF_UNUSED17 131072
+#define EF_UNUSED18 262144
+#define EF_UNUSED19 524288
+#define EF_UNUSED20 1048576
+#define EF_UNUSED21 2197152
+#define EF_LOWPRECISION 4194304 // LordHavoc: entity is low precision (integer coordinates) to save network bandwidth (serverside only)
+#define EF_UNUSED23 8388608
+#define EF_ROCKET 16777216 // leave a trail
+#define EF_GRENADE 33554432 // leave a trail
+#define EF_GIB 67108864 // leave a trail
+#define EF_ROTATE 134217728 // rotate (bonus items)
+#define EF_TRACER 268435456 // green split trail
+#define EF_ZOMGIB 536870912 // small blood trail
+#define EF_TRACER2 1073741824 // orange split trail + rotate
+#define EF_TRACER3 0x80000000 // purple trail
+
+// internaleffects bits (no overlap with EF_ bits):
+#define INTEF_FLAG1QW 1
+#define INTEF_FLAG2QW 2
// flags for the pflags field of entities
#define PFLAGS_NOSHADOW 1
#define RENDER_COLORMAPPED 32
#define RENDER_SHADOW 65536 // cast shadow
#define RENDER_LIGHT 131072 // receive light
-#define RENDER_TRANSPARENT 262144 // can't light during opaque stage
-#define RENDER_NOCULLFACE 524288 // render as double sided (disable GL_CULL_FACE)
+#define RENDER_NOSELFSHADOW 262144 // render lighting on this entity before its own shadow is added to the scene
+// (note: all RENDER_NOSELFSHADOW entities are grouped together and rendered in a batch before their shadows are rendered, so they can not shadow eachother either)
-// this is 88 bytes
+// this is 80 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
int effects;
- unsigned int customizeentityforclient; // !
+ unsigned short number; // entity number this state is for
unsigned short modelindex;
unsigned short frame;
unsigned short tagentity;
- unsigned short specialvisibilityradius; // ! larger if it has effects/light
- unsigned short viewmodelforclient; // !
- unsigned short exteriormodelforclient; // ! not shown if first person viewing from this entity, shown in all other cases
- unsigned short nodrawtoclient; // !
- unsigned short drawonlytoclient; // !
unsigned short light[4]; // color*256 (0.00 to 255.996), and radius*1
unsigned char active; // true if a valid state
unsigned char lightstyle;
unsigned char glowsize;
unsigned char glowcolor;
unsigned char flags;
+ unsigned char internaleffects; // INTEF_FLAG1QW and so on
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;
}
entity_state_t;
extern entity_state_t defaultstate;
// reads a quake entity from the network stream
void EntityFrameQuake_ReadEntity(int bits);
+// checks for stats changes and sets corresponding host_client->statsdeltabits
+// (also updates host_client->stats array)
+void Protocol_UpdateClientStats(const int *stats);
+// writes reliable messages updating stats (not used by DP6 and later
+// protocols which send updates in their WriteFrame function using a different
+// method of reliable messaging)
+void Protocol_WriteStatsReliable(void);
// writes a list of quake entities to the network stream
// (or as many will fit)
void EntityFrameQuake_WriteFrame(sizebuf_t *msg, int numstates, const entity_state_t *states);
server updates entities in looping ranges, a frame consists of a range of visible entities (not always all visible entities),
*/
+#define MAX_ENTITY_HISTORY 64
+#define MAX_ENTITY_DATABASE (MAX_EDICTS * 2)
+
+// build entity data in this, to pass to entity read/write functions
+typedef struct entity_frame_s
+{
+ double time;
+ int framenum;
+ int numentities;
+ int firstentitynum;
+ int lastentitynum;
+ vec3_t eye;
+ entity_state_t entitydata[MAX_ENTITY_DATABASE];
+}
+entity_frame_t;
+
typedef struct entity_frameinfo_s
{
double time;
}
entity_frameinfo_t;
-#define MAX_ENTITY_HISTORY 64
-#define MAX_ENTITY_DATABASE (MAX_EDICTS * 2)
-
typedef struct entityframe_database_s
{
// note: these can be far out of range, modulo with MAX_ENTITY_DATABASE to get a valid range (which may wrap)
entity_frameinfo_t frames[MAX_ENTITY_HISTORY];
// entities
entity_state_t entitydata[MAX_ENTITY_DATABASE];
-}
-entityframe_database_t;
-// build entity data in this, to pass to entity read/write functions
-typedef struct entity_frame_s
-{
- double time;
- int framenum;
- int numentities;
- int firstentitynum;
- int lastentitynum;
- vec3_t eye;
- entity_state_t entitydata[MAX_ENTITY_DATABASE];
+ // structs for building new frames and reading them
+ entity_frame_t deltaframe;
+ entity_frame_t framedata;
}
-entity_frame_t;
+entityframe_database_t;
// LordHavoc: these are in approximately sorted order, according to cost and
// likelyhood of being used for numerous objects in a frame
#define ENTITYFRAME5_MAXPACKETLOGS 64
#define ENTITYFRAME5_MAXSTATES 1024
+#define ENTITYFRAME5_PRIORITYLEVELS 32
typedef struct entityframe5_changestate_s
{
// (derived from states)
unsigned char *visiblebits; // [(maxedicts+7)/8]
- // delta compression of stats
- unsigned char statsdeltabits[(MAX_CL_STATS+7)/8];
- int stats[MAX_CL_STATS];
-
// old notes
// this is used to decide which changestates to set each frame
// rather than a memmove to remove them from the start.
//int numchangestates;
//entityframe5_changestate_t changestates[MAX_EDICTS];
+
+ // buffers for building priority info
+ int prioritychaincounts[ENTITYFRAME5_PRIORITYLEVELS];
+ unsigned short prioritychains[ENTITYFRAME5_PRIORITYLEVELS][ENTITYFRAME5_MAXSTATES];
}
entityframe5_database_t;
void EntityFrame5_CL_ReadFrame(void);
void EntityFrame5_LostFrame(entityframe5_database_t *d, int framenum);
void EntityFrame5_AckFrame(entityframe5_database_t *d, int framenum);
-void EntityFrame5_WriteFrame(sizebuf_t *msg, entityframe5_database_t *d, int numstates, const entity_state_t *states, int viewentnum, int *stats, int movesequence);
+void EntityFrame5_WriteFrame(sizebuf_t *msg, entityframe5_database_t *d, int numstates, const entity_state_t *states, int viewentnum, int movesequence);
extern cvar_t developer_networkentities;