From 3c08da6086d5c2431dd929543ed89afb79956423 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Fri, 27 Mar 2015 14:17:55 +0100 Subject: implement the entity 64-bit client-masking extension rename the previously unused entityShared_t::s to hack, and make use of it TODO: remove the said field, and add and use ``int hiMask'' instead --- src/game/g_public.h | 9 ++++++--- src/server/sv_init.c | 3 +++ src/server/sv_snapshot.c | 11 +++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/game/g_public.h b/src/game/g_public.h index 43b3f5de..cb3a27b2 100644 --- a/src/game/g_public.h +++ b/src/game/g_public.h @@ -31,7 +31,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // special server behaviors #define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects -#define SVF_CLIENTMASK 0x00000002 +#define SVF_CLIENTMASK 0x00000002 // send to clients specified by these bitmasks: + // entityShared_t->singleClient: low-order bits (0..31) + // entityShared_t->hack.generic1: high-order bits (32..63) #define SVF_BROADCAST 0x00000020 // send to all connected clients #define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots @@ -49,12 +51,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA typedef struct { - entityState_t s; // communicated by server to clients + entityState_t hack; // exists (as padding) to retain ABI compatibility + // with GPP, but can be used for extension hacks qboolean linked; // qfalse if not in any good cluster int linkcount; - int svFlags; // SVF_NOCLIENT, SVF_BROADCAST, etc + int svFlags; // SVF_NOCLIENT, SVF_BROADCAST, etc. int singleClient; // only send to this client when SVF_SINGLECLIENT is set qboolean bmodel; // if false, assume an explicit mins / maxs bounding box diff --git a/src/server/sv_init.c b/src/server/sv_init.c index 9934fa7e..380a117e 100644 --- a/src/server/sv_init.c +++ b/src/server/sv_init.c @@ -498,6 +498,9 @@ void SV_SpawnServer( char *server, qboolean killBots ) { sv.checksumFeed = ( ((int) rand() << 16) ^ rand() ) ^ Com_Milliseconds(); FS_Restart( sv.checksumFeed ); + // advertise GPP-compatible extensions + Cvar_Set( "sv_gppExtension", "1" ); + CM_LoadMap( va("maps/%s.bsp", server), qfalse, &checksum ); // set serverinfo visible name diff --git a/src/server/sv_snapshot.c b/src/server/sv_snapshot.c index 58136388..57d4e64b 100644 --- a/src/server/sv_snapshot.c +++ b/src/server/sv_snapshot.c @@ -349,10 +349,13 @@ static void SV_AddEntitiesVisibleFromPoint( vec3_t origin, clientSnapshot_t *fra } // entities can be flagged to be sent to a given mask of clients if ( ent->r.svFlags & SVF_CLIENTMASK ) { - if (frame->ps.clientNum >= 32) - Com_Error( ERR_DROP, "SVF_CLIENTMASK: clientNum >= 32" ); - if (~ent->r.singleClient & (1 << frame->ps.clientNum)) - continue; + if ( frame->ps.clientNum >= 32 ) { + if ( ~ent->r.hack.generic1 & ( 1 << ( frame->ps.clientNum - 32 ) ) ) + continue; + } else { + if ( ~ent->r.singleClient & ( 1 << frame->ps.clientNum ) ) + continue; + } } svEnt = SV_SvEntityForGentity( ent ); -- cgit