diff --git a/inc/shared/game.h b/inc/shared/game.h index e5f69700a..8c5fd4d76 100644 --- a/inc/shared/game.h +++ b/inc/shared/game.h @@ -44,15 +44,18 @@ typedef enum { // extended features -#define GMF_CLIENTNUM 0x00000001 -#define GMF_PROPERINUSE 0x00000002 -#define GMF_MVDSPEC 0x00000004 -#define GMF_WANT_ALL_DISCONNECTS 0x00000008 - -#define GMF_ENHANCED_SAVEGAMES 0x00000400 -#define GMF_VARIABLE_FPS 0x00000800 -#define GMF_EXTRA_USERINFO 0x00001000 -#define GMF_IPV6_ADDRESS_AWARE 0x00002000 +// R1Q2 and Q2PRO specific +#define GMF_CLIENTNUM 0x00000001 // game sets clientNum gclient_s field +#define GMF_PROPERINUSE 0x00000002 // game maintains edict_s inuse field properly +#define GMF_MVDSPEC 0x00000004 // game is dummy MVD client aware +#define GMF_WANT_ALL_DISCONNECTS 0x00000008 // game wants ClientDisconnect() for non-spawned clients + +// Q2PRO specific +#define GMF_ENHANCED_SAVEGAMES 0x00000400 // game supports safe/portable savegames +#define GMF_VARIABLE_FPS 0x00000800 // game supports variable server FPS +#define GMF_EXTRA_USERINFO 0x00001000 // game wants extra userinfo after normal userinfo +#define GMF_IPV6_ADDRESS_AWARE 0x00002000 // game supports IPv6 addresses +#define GMF_ALLOW_INDEX_OVERFLOW 0x00004000 // game wants PF_FindIndex() to return 0 on overflow //=============================================================== @@ -69,9 +72,12 @@ struct gclient_s { player_state_t ps; // communicated by server to clients int ping; + // set to (client POV entity number) - 1 by game, + // only valid if g_features has GMF_CLIENTNUM bit + int clientNum; + // the game dll can add anything it wants after // this point in the structure - int clientNum; }; diff --git a/src/server/game.c b/src/server/game.c index 50ccd6037..60a846884 100644 --- a/src/server/game.c +++ b/src/server/game.c @@ -49,6 +49,10 @@ static int PF_FindIndex(const char *name, int start, int max, const char *func) } if (i == max) { + if (g_features->integer & GMF_ALLOW_INDEX_OVERFLOW) { + Com_DPrintf("%s(%s): overflow\n", func, name); + return 0; + } Com_Error(ERR_DROP, "%s(%s): overflow", func, name); } @@ -113,7 +117,7 @@ static void PF_Unicast(edict_t *ent, qboolean reliable) flags |= MSG_RELIABLE; } - if (cmd == svc_layout || (cmd == svc_configstring && msg_write.data[1] == CS_STATUSBAR)) { + if (cmd == svc_layout || (cmd == svc_configstring && RL16(&msg_write.data[1]) == CS_STATUSBAR)) { flags |= MSG_COMPRESS_AUTO; } diff --git a/src/server/server.h b/src/server/server.h index 7572901a8..19477923e 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -89,7 +89,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define SV_FEATURES (GMF_CLIENTNUM | GMF_PROPERINUSE | GMF_MVDSPEC | \ GMF_WANT_ALL_DISCONNECTS | GMF_ENHANCED_SAVEGAMES | \ SV_GMF_VARIABLE_FPS | GMF_EXTRA_USERINFO | \ - GMF_IPV6_ADDRESS_AWARE) + GMF_IPV6_ADDRESS_AWARE | GMF_ALLOW_INDEX_OVERFLOW) // ugly hack for SV_Shutdown #define MVD_SPAWN_DISABLED 0