diff --git a/code/botlib/be_aas_main.c b/code/botlib/be_aas_main.c index 046a48f..6f5bf95 100644 --- a/code/botlib/be_aas_main.c +++ b/code/botlib/be_aas_main.c @@ -292,8 +292,8 @@ int AAS_LoadMap(const char *mapname) //=========================================================================== int AAS_Setup(void) { - aasworld.maxclients = (int) LibVarValue("maxclients", "128"); - aasworld.maxentities = (int) LibVarValue("maxentities", "1024"); + aasworld.maxclients = (int) LibVarValue("maxclients", "256"); + aasworld.maxentities = (int) LibVarValue("maxentities", "4096"); // as soon as it's set to 1 the routing cache will be saved saveroutingcache = LibVar("saveroutingcache", "0"); //allocate memory for the entities diff --git a/code/botlib/be_interface.c b/code/botlib/be_interface.c index 2337275..e59d560 100644 --- a/code/botlib/be_interface.c +++ b/code/botlib/be_interface.c @@ -133,8 +133,8 @@ static int Export_BotLibSetup( void ) botimport.Print( PRT_MESSAGE, "------- BotLib Initialization -------\n" ); - botlibglobals.maxclients = (int) LibVarValue( "maxclients", "64" ); - botlibglobals.maxentities = (int) LibVarValue( "maxentities", "1024" ); + botlibglobals.maxclients = (int) LibVarValue( "maxclients", "256" ); + botlibglobals.maxentities = (int) LibVarValue( "maxentities", "4096" ); errnum = AAS_Setup(); //be_aas_main.c if (errnum != BLERR_NOERROR) return errnum; diff --git a/code/botlib/botlib.h b/code/botlib/botlib.h index 1b4307c..5779675 100644 --- a/code/botlib/botlib.h +++ b/code/botlib/botlib.h @@ -445,7 +445,7 @@ name: default: module(s): description: "log" "0" l_log.c enable/disable creating a log file "maxclients" "4" be_interface.c maximum number of clients -"maxentities" "1024" be_interface.c maximum number of entities +"maxentities" "4096" be_interface.c maximum number of entities "bot_developer" "0" be_interface.c bot developer mode (it's "botDeveloper" in C to prevent symbol clash). "phys_friction" "6" be_aas_move.c ground friction diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h index 65fa5d6..e68b406 100644 --- a/code/qcommon/q_shared.h +++ b/code/qcommon/q_shared.h @@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // q_shared.h -- included first by ALL program modules. // A user mod should never modify this file -#define Q3_VERSION "MiTech 2.1" +#define Q3_VERSION "MiTech 2.2" #ifndef SVN_VERSION #define SVN_VERSION Q3_VERSION #endif diff --git a/code/renderer/tr_bsp.c b/code/renderer/tr_bsp.c index dd3219a..c0800bc 100644 --- a/code/renderer/tr_bsp.c +++ b/code/renderer/tr_bsp.c @@ -1982,7 +1982,7 @@ static void R_LoadFogs( const lump_t *l, const lump_t *brushesLump, const lump_t fogColor[1] = LERP( fogColor[1], luminance, r_mapGreyScale->value ); fogColor[2] = LERP( fogColor[2], luminance, r_mapGreyScale->value ); } - + if ( r_mapColorScale->value > 0 ) { float luminance; luminance = LUMA( fogColor[0], fogColor[1], fogColor[2] ); diff --git a/code/server/server.h b/code/server/server.h index d05ad18..9e9d11a 100644 --- a/code/server/server.h +++ b/code/server/server.h @@ -298,6 +298,7 @@ extern cvar_t *sv_dlRate; extern cvar_t *sv_gametype; extern cvar_t *sv_pure; extern cvar_t *sv_floodProtect; +extern cvar_t *sv_viewdistance; extern cvar_t *sv_lanForceRate; extern cvar_t *sv_levelTimeReset; diff --git a/code/server/sv_init.c b/code/server/sv_init.c index 6540486..feee4d5 100644 --- a/code/server/sv_init.c +++ b/code/server/sv_init.c @@ -727,6 +727,7 @@ void SV_Init( void ) Cvar_SetDescription( sv_dlRate, "Bandwidth allotted to PK3 file downloads via UDP, in kbyte/s." ); sv_floodProtect = Cvar_Get( "sv_floodProtect", "1", CVAR_ARCHIVE | CVAR_SERVERINFO ); Cvar_SetDescription( sv_floodProtect, "Toggle server flood protection to keep players from bringing the server down." ); + sv_viewdistance = Cvar_Get( "sv_viewdistance", "16", CVAR_ARCHIVE | CVAR_SERVERINFO ); // systeminfo Cvar_Get( "sv_cheats", "1", CVAR_SYSTEMINFO | CVAR_ROM ); diff --git a/code/server/sv_main.c b/code/server/sv_main.c index c1289fa..af205c0 100644 --- a/code/server/sv_main.c +++ b/code/server/sv_main.c @@ -52,6 +52,7 @@ cvar_t *sv_dlRate; cvar_t *sv_gametype; cvar_t *sv_pure; cvar_t *sv_floodProtect; +cvar_t *sv_viewdistance; cvar_t *sv_lanForceRate; // dedicated 1 (LAN) server forces local client rates to 99999 (bug #491) cvar_t *sv_levelTimeReset; diff --git a/code/server/sv_snapshot.c b/code/server/sv_snapshot.c index baca9b1..1c6f263 100644 --- a/code/server/sv_snapshot.c +++ b/code/server/sv_snapshot.c @@ -321,6 +321,9 @@ static void SV_AddEntitiesVisibleFromPoint( const vec3_t origin, clientSnapshot_ int leafnum; byte *clientpvs; byte *bitvector; + vec3_t dir; + float distanceSquared; + float maxViewDistanceSquared; // during an error shutdown message we may need to transmit // the shutdown message after the server has shutdown, so @@ -338,6 +341,8 @@ static void SV_AddEntitiesVisibleFromPoint( const vec3_t origin, clientSnapshot_ clientpvs = CM_ClusterPVS (clientcluster); + maxViewDistanceSquared = (sv_viewdistance->integer*512) * (sv_viewdistance->integer*512); + for ( e = 0 ; e < svs.currFrame->count; e++ ) { es = svs.currFrame->ents[ e ]; ent = SV_GentityNum( es->number ); @@ -416,6 +421,17 @@ static void SV_AddEntitiesVisibleFromPoint( const vec3_t origin, clientSnapshot_ } }*/ + // calculate distance from the entity to the client + VectorSubtract(ent->r.currentOrigin, origin, dir); + distanceSquared = VectorLengthSquared(dir); + + // check if the entity is within the max view distance + if (distanceSquared > maxViewDistanceSquared) { + if (ent->s.eType != ET_PLAYER && ent->s.eType != ET_BEAM && ent->s.eType != ET_MOVER) { + continue; + } + } + // add it SV_AddIndexToSnapshot( svEnt, e, eNums );