]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - protocol.h
fix bugs in Mod_Q3BSP_Loadtextures that caused crashes and other
[xonotic/darkplaces.git] / protocol.h
index 00f25a8946cb8537698441b45563ae200b198898..04faf61ea390d727f81e868d589bea24366369af 100644 (file)
@@ -31,14 +31,15 @@ int Protocol_NumberForEnum(protocolversion_t p);
 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
@@ -48,21 +49,34 @@ void Protocol_Names(char *buffer, size_t buffersize);
 #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
@@ -319,14 +333,15 @@ void Protocol_Names(char *buffer, size_t buffersize);
 #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 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
@@ -353,8 +368,9 @@ typedef struct entity_state_s
        unsigned char flags;
        unsigned char tagindex;
        unsigned char colormod[3];
+       unsigned char internaleffects; // INTEF_FLAG1QW and so on
        // padding to a multiple of 8 bytes (to align the double time)
-       unsigned char unused[6];
+       unsigned char unused;
 }
 entity_state_t;
 
@@ -362,6 +378,13 @@ 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);
@@ -733,10 +756,6 @@ typedef struct entityframe5_database_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
@@ -759,7 +778,7 @@ int EntityState5_DeltaBitsForState(entity_state_t *o, entity_state_t *n);
 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;