From bc6a2e1b39d8b7f65535760fa6d2e8c2348fdc2d Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Sun, 3 Nov 2024 19:58:38 +0100 Subject: [PATCH 1/2] EXTENSION: Fix FTE_PEXT_TRANS. The extension was incorrectly implemented from the beginning. To support the extra bits support for PF_EXTRA_PFS is needed which results in an extra byte of player flags. With a 24 bit player flags PF_ONGROUND and PF_SOLID are then found at a higher offset. This added offset is typically emulated by upshifting the relevant bits in incoming data if PEXT_TRANS is not part of the extensions the client announces support for to be able to use the same definitions in both cases. --- src/protocol.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/protocol.h b/src/protocol.h index 3a636d5..065eea7 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -291,8 +291,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // bits 11..13 are player move type bits (ZQuake extension) #define PF_PMC_SHIFT 11 #define PF_PMC_MASK 7 +#ifdef FTE_PEXT_TRANS +#define PF_ONGROUND (1<<22) // ZQuake extension, 14 offset to extra playerflags +#define PF_SOLID (1<<23) // ZQuake extension, 15 offset to extra playerflags +#else #define PF_ONGROUND (1<<14) // ZQuake extension #define PF_SOLID (1<<15) // ZQuake extension +#endif // encoded player move types #define PMC_NORMAL 0 // normal ground movement @@ -362,6 +367,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # endif // FTE_PEXT_SCALE # ifdef FTE_PEXT_TRANS # define U_FTE_TRANS (1<<1) //transparency value +# define PF_EXTRA_PFS (1<<15) //TRANS requires extra playerflags # define PF_TRANS_Z (1<<17) # endif // FTE_PEXT_TRANS # ifdef FTE_PEXT_FATNESS @@ -460,7 +466,9 @@ typedef struct entity_state_s { int colormap; int skinnum; int effects; - byte trans; +#ifdef FTE_PEXT_TRANS + byte trans; +#endif } entity_state_t; #define MAX_PACKET_ENTITIES 64 // doesn't include nails From 53e14402c5574e30819875866290418ee1f4e150 Mon Sep 17 00:00:00 2001 From: Daniel Svensson Date: Sun, 3 Nov 2024 20:16:18 +0100 Subject: [PATCH 2/2] EXTENSION: Finish FTE_PEXT_COLOURMOD definitions. Support for colourmod was partially declared in protocol.h, but missing the entity_state_t bytes, as well as a few defines. colourmod[3] is r/g/b with 1/32 precision, thus a value of 32 corresponds to 1.0f, which in effect means no color modification, and the same is true for 0.0f. Values above 1.0f yields overbrights. --- src/protocol.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/protocol.h b/src/protocol.h index 065eea7..273f50f 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -41,6 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # define FTE_PEXT_ENTITYDBL2 0x00004000 // max of 1024 ents instead of 512 # define FTE_PEXT_FLOATCOORDS 0x00008000 // supports floating point origins. # define FTE_PEXT_SPAWNSTATIC2 0x00400000 // Sends an entity delta instead of a baseline. +# define FTE_PEXT_COLOURMOD 0x00080000 // Sends three bytes of color modification for an entity # define FTE_PEXT_256PACKETENTITIES 0x01000000 // Client can recieve 256 packet entities. # define FTE_PEXT_CHUNKEDDOWNLOADS 0x20000000 // alternate file download method. Hopefully it'll give // quadroupled download speed, especially on higher pings. @@ -375,6 +376,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //moves verticies along normals // Useful for vacuum chambers... # endif // FTE_PEXT_FATNESS +# ifdef FTE_PEXT_COLOURMOD +# define PF_COLOURMOD (1<<19) +# endif // FTE_PEXT_COLOURMOD # ifdef FTE_PEXT_MODELDBL # define U_FTE_MODELDBL (1<<3) //extra bit for modelindexes # endif // FTE_PEXT_MODELDBL @@ -388,7 +392,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # define U_FTE_YETMORE (1<<7) //even more extension info stuff. # define U_FTE_DRAWFLAGS (1<<8) //use an extra qbyte for origin parts, cos one of them is off # define U_FTE_ABSLIGHT (1<<9) //Force a lightlevel -# define U_FTE_COLOURMOD (1<<10) //rgb +# ifdef FTE_PEXT_COLOURMOD +# define U_FTE_COLOURMOD (1<<10) //rgb +# endif // FTE_PEXT_COLOURMOD # define U_FTE_DPFLAGS (1<<11) # define U_FTE_TAGINFO (1<<12) # define U_FTE_LIGHT (1<<13) @@ -469,6 +475,9 @@ typedef struct entity_state_s { #ifdef FTE_PEXT_TRANS byte trans; #endif +#ifdef FTE_PEXT_COLOURMOD + byte colourmod[3]; +#endif } entity_state_t; #define MAX_PACKET_ENTITIES 64 // doesn't include nails