Skip to content

Commit

Permalink
EXTENSION: Fix FTE_PEXT_TRANS.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dsvensson committed Nov 4, 2024
1 parent f0c2f9e commit bc6a2e1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bc6a2e1

Please sign in to comment.