/* =============== SV_Init Only called at quake2.exe startup, not for each game =============== */ void SV_Init(void) { SV_InitOperatorCommands(); rcon_password = Cvar_Get("rcon_password", "", 0); Cvar_Get("skill", "1", 0); Cvar_Get("deathmatch", "0", CVAR_LATCH); Cvar_Get("coop", "0", CVAR_LATCH); Cvar_Get("dmflags", va("%i", DF_INSTANT_ITEMS), CVAR_SERVERINFO); Cvar_Get("fraglimit", "0", CVAR_SERVERINFO); Cvar_Get("timelimit", "0", CVAR_SERVERINFO); Cvar_Get("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH); Cvar_Get("protocol", va("%i", PROTOCOL_VERSION), CVAR_SERVERINFO | CVAR_NOSET); maxclients = Cvar_Get("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH); hostname = Cvar_Get("hostname", "noname", CVAR_SERVERINFO | CVAR_ARCHIVE); timeout = Cvar_Get("timeout", "125", 0); zombietime = Cvar_Get("zombietime", "2", 0); sv_showclamp = Cvar_Get("showclamp", "0", 0); sv_paused = Cvar_Get("paused", "0", 0); sv_timedemo = Cvar_Get("timedemo", "0", 0); sv_enforcetime = Cvar_Get("sv_enforcetime", "0", 0); allow_download = Cvar_Get("allow_download", "0", CVAR_ARCHIVE); allow_download_players = Cvar_Get("allow_download_players", "0", CVAR_ARCHIVE); allow_download_models = Cvar_Get("allow_download_models", "1", CVAR_ARCHIVE); allow_download_sounds = Cvar_Get("allow_download_sounds", "1", CVAR_ARCHIVE); allow_download_maps = Cvar_Get("allow_download_maps", "1", CVAR_ARCHIVE); sv_noreload = Cvar_Get("sv_noreload", "0", 0); sv_airaccelerate = Cvar_Get("sv_airaccelerate", "0", CVAR_LATCH); public_server = Cvar_Get("public", "0", 0); sv_reconnect_limit = Cvar_Get("sv_reconnect_limit", "3", CVAR_ARCHIVE); SZ_Init(&net_message, net_message_buffer, sizeof(net_message_buffer)); }
/** * @brief Only called once at startup, not for each game */ void SV_Init (void) { Com_Printf("\n------ server initialization -------\n"); sv_genericPool = Mem_CreatePool("Server: Generic"); OBJZERO(svs); sv = (serverInstanceGame_t *) Mem_PoolAlloc(sizeof(*sv), sv_genericPool, 0); SV_InitOperatorCommands(); rcon_password = Cvar_Get("rcon_password", "", 0, NULL); Cvar_Get("sv_cheats", "0", CVAR_SERVERINFO | CVAR_LATCH, NULL); Cvar_Get("sv_protocol", DOUBLEQUOTE(PROTOCOL_VERSION), CVAR_SERVERINFO | CVAR_NOSET, NULL); /* this cvar will become a latched cvar when you start the server */ sv_maxclients = Cvar_Get("sv_maxclients", "1", CVAR_SERVERINFO, "Max. connected clients"); sv_hostname = Cvar_Get("sv_hostname", "noname", CVAR_SERVERINFO | CVAR_ARCHIVE, "The name of the server that is displayed in the serverlist"); sv_http_downloadserver = Cvar_Get("sv_http_downloadserver", "", CVAR_ARCHIVE, "URL to a location where clients can download game content over HTTP"); sv_enablemorale = Cvar_Get("sv_enablemorale", "1", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_LATCH, "Enable morale changes in multiplayer"); sv_maxsoldiersperteam = Cvar_Get("sv_maxsoldiersperteam", "4", CVAR_ARCHIVE | CVAR_SERVERINFO, "Max. amount of soldiers per team (see sv_maxsoldiersperplayer and sv_teamplay)"); sv_maxsoldiersperplayer = Cvar_Get("sv_maxsoldiersperplayer", "8", CVAR_ARCHIVE | CVAR_SERVERINFO, "Max. amount of soldiers each player can controll (see maxsoldiers and sv_teamplay)"); Cvar_SetCheckFunction("sv_maxsoldiersperplayer", SV_CheckMaxSoldiersPerPlayer); sv_dumpmapassembly = Cvar_Get("sv_dumpmapassembly", "0", CVAR_ARCHIVE, "Dump map assembly information to game console"); sv_threads = Cvar_Get("sv_threads", "1", CVAR_LATCH | CVAR_ARCHIVE, "Run the server threaded"); sv_public = Cvar_Get("sv_public", "1", 0, "Should heartbeats be send to the masterserver"); sv_reconnect_limit = Cvar_Get("sv_reconnect_limit", "3", CVAR_ARCHIVE, "Minimum seconds between connect messages"); SV_MapcycleInit(); }
/* =============== SV_Init Only called at quake2.exe startup, not for each game =============== */ void SV_Init (void) { Q_STInit(&packet_stable, packet_stable.size, 8, TAG_SERVER); s_ping = Q_STAutoRegister(&packet_stable, "ping"); s_ack = Q_STAutoRegister(&packet_stable, "ack"); s_status = Q_STAutoRegister(&packet_stable, "status"); s_info = Q_STAutoRegister(&packet_stable, "info"); s_getchallenge = Q_STAutoRegister(&packet_stable, "getchallenge"); s_connect = Q_STAutoRegister(&packet_stable, "connect"); s_rcon = Q_STAutoRegister(&packet_stable, "rcon"); Q_STAutoPack(&packet_stable); SV_InitOperatorCommands (); rcon_password = Cvar_Get ("rcon_password", "", 0); Cvar_Get ("skill", "1", 0); Cvar_Get ("deathmatch", "0", CVAR_LATCH); Cvar_Get ("coop", "0", CVAR_LATCH); Cvar_Get ("dmflags", va("%i", DF_INSTANT_ITEMS), CVAR_SERVERINFO); Cvar_Get ("fraglimit", "0", CVAR_SERVERINFO); Cvar_Get ("timelimit", "0", CVAR_SERVERINFO); Cvar_Get ("cheats", "0", CVAR_SERVERINFO|CVAR_LATCH); Cvar_Get ("protocol", va("%i", PROTOCOL_VERSION), CVAR_SERVERINFO|CVAR_NOSET);; maxclients = Cvar_Get ("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH); hostname = Cvar_Get ("hostname", "noname", CVAR_SERVERINFO | CVAR_ARCHIVE); timeout = Cvar_Get ("timeout", "125", 0); zombietime = Cvar_Get ("zombietime", "2", 0); sv_showclamp = Cvar_Get ("showclamp", "0", 0); sv_paused = Cvar_Get ("paused", "0", 0); sv_timedemo = Cvar_Get ("timedemo", "0", 0); sv_enforcetime = Cvar_Get ("sv_enforcetime", "0", 0); allow_download = Cvar_Get ("allow_download", "1", CVAR_ARCHIVE); allow_download_players = Cvar_Get ("allow_download_players", "0", CVAR_ARCHIVE); allow_download_models = Cvar_Get ("allow_download_models", "1", CVAR_ARCHIVE); allow_download_sounds = Cvar_Get ("allow_download_sounds", "1", CVAR_ARCHIVE); allow_download_maps = Cvar_Get ("allow_download_maps", "1", CVAR_ARCHIVE); allow_download_pics = Cvar_Get ("allow_download_pics", "1", CVAR_ARCHIVE); allow_download_textures = Cvar_Get ("allow_download_textures", "1", CVAR_ARCHIVE); // Knightmare- whether to allow downloading 24-bit textures allow_download_textures_24bit = Cvar_Get ("allow_download_textures_24bit", "0", CVAR_ARCHIVE); sv_noreload = Cvar_Get ("sv_noreload", "0", 0); sv_airaccelerate = Cvar_Get("sv_airaccelerate", "0", CVAR_LATCH); public_server = Cvar_Get ("public", "0", 0); sv_iplimit = Cvar_Get ("sv_iplimit", "3", 0); // r1ch: limit connections per ip address (stop zombie dos/flood) sv_reconnect_limit = Cvar_Get ("sv_reconnect_limit", "3", CVAR_ARCHIVE); sv_entfile = Cvar_Get ("sv_entfile", "1", CVAR_ARCHIVE); // whether to use .ent file sv_legacy_libraries = Cvar_Get("sv_legacy_libraries", "0", CVAR_CLIENT); // disable loading legacy game libraries by default SZ_Init (&net_message, net_message_buffer, sizeof(net_message_buffer)); SV_InitClientCommands(); }
/* * =============== * SV_Init * * Only called at quake2.exe startup, not for each game * =============== */ void SV_Init(void) { SV_InitOperatorCommands(); rcon_password = Cvar_Get("rcon_password", "", 0); Cvar_Get("skill", "1", 0); Cvar_Get("deathmatch", "0", CVAR_LATCH); Cvar_Get("coop", "0", CVAR_LATCH); Cvar_Get("dmflags", va("%i", DF_INSTANT_ITEMS), CVAR_SERVERINFO); Cvar_Get("fraglimit", "0", CVAR_SERVERINFO); Cvar_Get("timelimit", "0", CVAR_SERVERINFO); Cvar_Get("cheats", "0", CVAR_SERVERINFO | CVAR_LATCH); Cvar_Get("protocol", va("%i", PROTOCOL_VERSION), CVAR_SERVERINFO | CVAR_NOSET); maxclients = Cvar_Get("maxclients", "1", CVAR_SERVERINFO | CVAR_LATCH); hostname = Cvar_Get("hostname", "noname", CVAR_SERVERINFO | CVAR_ARCHIVE); timeout = Cvar_Get("timeout", "125", 0); zombietime = Cvar_Get("zombietime", "2", 0); sv_showclamp = Cvar_Get("showclamp", "0", 0); sv_paused = Cvar_Get("paused", "0", 0); sv_timedemo = Cvar_Get("timedemo", "0", 0); sv_enforcetime = Cvar_Get("sv_enforcetime", "0", 0); allow_download = Cvar_Get("allow_download", "1", CVAR_ARCHIVE); allow_download_players = Cvar_Get("allow_download_players", "0", CVAR_ARCHIVE); allow_download_models = Cvar_Get("allow_download_models", "1", CVAR_ARCHIVE); allow_download_sounds = Cvar_Get("allow_download_sounds", "1", CVAR_ARCHIVE); allow_download_maps = Cvar_Get("allow_download_maps", "1", CVAR_ARCHIVE); allow_download_pics = Cvar_Get("allow_download_pics", "1", CVAR_ARCHIVE); allow_download_textures = Cvar_Get("allow_download_textures", "1", CVAR_ARCHIVE); // Knightmare- whether to allow downloading 24-bit textures allow_download_textures_24bit = Cvar_Get("allow_download_textures_24bit", "0", CVAR_ARCHIVE); sv_noreload = Cvar_Get("sv_noreload", "0", 0); sv_airaccelerate = Cvar_Get("sv_airaccelerate", "0", CVAR_LATCH); public_server = Cvar_Get("public", "0", 0); sv_iplimit = Cvar_Get("sv_iplimit", "3", 0); // r1ch: limit connections per ip address (stop zombie dos/flood) sv_reconnect_limit = Cvar_Get("sv_reconnect_limit", "3", CVAR_ARCHIVE); sv_entfile = Cvar_Get("sv_entfile", "1", CVAR_ARCHIVE); // whether to use .ent file SZ_Init(&net_message, net_message_buffer, sizeof(net_message_buffer)); }
/* =============== SV_InitLocal =============== */ void SV_InitLocal (void) { int i; extern cvar_t sv_spectalk; extern cvar_t sv_mapcheck; extern cvar_t sv_minping; extern cvar_t sv_maxpitch; extern cvar_t sv_minpitch; extern cvar_t sv_nailhack; extern cvar_t sv_loadentfiles; extern cvar_t sv_maxvelocity; extern cvar_t sv_gravity; extern cvar_t pm_stopspeed; extern cvar_t pm_spectatormaxspeed; extern cvar_t pm_accelerate; extern cvar_t pm_airaccelerate; extern cvar_t pm_wateraccelerate; extern cvar_t pm_friction; extern cvar_t pm_waterfriction; extern cvar_t pm_bunnyspeedcap; extern cvar_t pm_ktjump; extern cvar_t pm_slidefix; extern cvar_t pm_airstep; extern cvar_t pm_pground; packet_t *packet_freeblock; // initialise delayed packet free block SV_InitOperatorCommands (); Cvar_Register (&sv_rconPassword); Cvar_Register (&sv_password); Cvar_Register (&sv_spectatorPassword); Cvar_Register (&sv_phs); Cvar_Register (&sv_paused); Cvar_Register (&sv_pausable); Cmd_AddLegacyCommand ("pausable", "sv_pausable"); Cvar_Register (&sv_nailhack); Cvar_Register (&sv_maxrate); Cvar_Register (&sv_fastconnect); Cvar_Register (&sv_loadentfiles); if (!dedicated) sv_mintic.string = "0"; // a value of 0 will tie physics tics to screen updates Cvar_Register (&sv_mintic); Cvar_Register (&sv_maxtic); Cvar_Register (&sv_timeout); Cmd_AddLegacyCommand ("timeout", "sv_timeout"); Cvar_Register (&sv_zombietime); Cmd_AddLegacyCommand ("zombietime", "sv_zombietime"); Cvar_Register (&sv_spectalk); Cvar_Register (&sv_mapcheck); if (dedicated) Cvar_Register (&sv_minping); Cvar_Register (&sv_maxpitch); Cvar_Register (&sv_minpitch); Cvar_Register (&deathmatch); Cvar_Register (&teamplay); Cvar_Register (&skill); Cvar_Register (&coop); Cvar_Register (&fraglimit); Cvar_Register (&timelimit); Cvar_Register (&samelevel); Cvar_Register (&maxclients); Cvar_Register (&maxspectators); Cvar_Register (&hostname); Cvar_Register (&watervis); Cvar_Register (&sv_maxvelocity); Cvar_Register (&sv_gravity); Cvar_Register (&pm_stopspeed); Cvar_Register (&pm_maxspeed); Cvar_Register (&pm_spectatormaxspeed); Cvar_Register (&pm_accelerate); Cvar_Register (&pm_airaccelerate); Cvar_Register (&pm_wateraccelerate); Cvar_Register (&pm_friction); Cvar_Register (&pm_waterfriction); Cvar_Register (&pm_bunnyspeedcap); Cvar_Register (&pm_ktjump); Cvar_Register (&pm_slidefix); Cvar_Register (&pm_airstep); Cvar_Register (&pm_pground); Cvar_Register (&allow_download); Cvar_Register (&allow_download_skins); Cvar_Register (&allow_download_models); Cvar_Register (&allow_download_sounds); Cvar_Register (&allow_download_maps); Cvar_Register (&allow_download_pakmaps); Cvar_Register (&allow_download_gfx); Cvar_Register (&allow_download_other); Cvar_Register (&filterban); Cmd_AddCommand ("addip", SV_AddIP_f); Cmd_AddCommand ("removeip", SV_RemoveIP_f); Cmd_AddCommand ("listip", SV_ListIP_f); Cmd_AddCommand ("writeip", SV_WriteIP_f); for (i=1 ; i<MAX_MODELS ; i++) sprintf (localmodels[i], "*%i", i); Info_SetValueForStarKey (svs.info, "*version", va(PROGRAM " %s", VersionString()), MAX_SERVERINFO_STRING); Info_SetValueForStarKey (svs.info, "*z_ext", va("%i", SUPPORTED_EXTENSIONS), MAX_SERVERINFO_STRING); #ifdef VWEP_TEST Info_SetValueForStarKey (svs.info, "*vwtest", "1", MAX_SERVERINFO_STRING); #endif if (strcmp(com_gamedirfile, "qw")) Info_SetValueForStarKey (svs.info, "*gamedir", com_gamedirfile, MAX_SERVERINFO_STRING); // init fraglog stuff svs.logsequence = 1; svs.logtime = svs.realtime; SZ_Init (&svs.log[0], svs.log_buf[0], sizeof(svs.log_buf[0])); svs.log[0].allowoverflow = true; SZ_Init (&svs.log[1], svs.log_buf[1], sizeof(svs.log_buf[1])); svs.log[1].allowoverflow = true; packet_freeblock = Hunk_AllocName(MAX_DELAYED_PACKETS * sizeof(packet_t), "delayed_packets"); for (i = 0; i < MAX_DELAYED_PACKETS; i++) { SZ_Init (&packet_freeblock[i].msg, packet_freeblock[i].buf, sizeof(packet_freeblock[i].buf)); packet_freeblock[i].next = &packet_freeblock[i + 1]; } packet_freeblock[MAX_DELAYED_PACKETS - 1].next = NULL; svs.free_packets = &packet_freeblock[0]; #ifdef MAUTH // Set up queues for temporary auth tokens and auth'd clients... authtokq.maxlen = MAX_AUTH_TOK_QUEUE; authtokq.curlen = 0; authtokq.start = NULL; authclientq.maxlen = MAX_AUTH_CLIENT_QUEUE; authclientq.curlen = 0; authclientq.start = NULL; #endif }
/* =============== SV_InitLocal =============== */ static void SV_InitLocal (void) { int i; SV_InitOperatorCommands (); SV_UserInit (); Cvar_RegisterVariable (&developer); if (COM_CheckParm("-developer")) { Cvar_SetValue("developer", 1); Cvar_LockVar ("developer"); } Cvar_RegisterVariable (&sys_nostdout); Cvar_RegisterVariable (&rcon_password); Cvar_RegisterVariable (&password); Cvar_RegisterVariable (&spectator_password); Cvar_RegisterVariable (&sv_mintic); Cvar_RegisterVariable (&sv_maxtic); Cvar_RegisterVariable (&fraglimit); Cvar_RegisterVariable (&timelimit); Cvar_RegisterVariable (&teamplay); Cvar_RegisterVariable (&samelevel); Cvar_RegisterVariable (&maxclients); Cvar_RegisterVariable (&maxspectators); Cvar_RegisterVariable (&hostname); Cvar_RegisterVariable (&skill); Cvar_RegisterVariable (&coop); Cvar_RegisterVariable (&deathmatch); Cvar_RegisterVariable (&randomclass); Cvar_RegisterVariable (&damageScale); Cvar_RegisterVariable (&meleeDamScale); Cvar_RegisterVariable (­Respawn); Cvar_RegisterVariable (&spartanPrint); Cvar_RegisterVariable (&manaScale); Cvar_RegisterVariable (&tomeMode); Cvar_RegisterVariable (&tomeRespawn); Cvar_RegisterVariable (&w2Respawn); Cvar_RegisterVariable (&altRespawn); Cvar_RegisterVariable (&fixedLevel); Cvar_RegisterVariable (&autoItems); Cvar_RegisterVariable (&dmMode); Cvar_RegisterVariable (&easyFourth); Cvar_RegisterVariable (&patternRunner); Cvar_RegisterVariable (&spawn); Cvar_RegisterVariable (&noexit); Cvar_RegisterVariable (&timeout); Cvar_RegisterVariable (&zombietime); Cvar_RegisterVariable (&sv_maxvelocity); Cvar_RegisterVariable (&sv_gravity); Cvar_RegisterVariable (&sv_stopspeed); Cvar_RegisterVariable (&sv_maxspeed); Cvar_RegisterVariable (&sv_spectatormaxspeed); Cvar_RegisterVariable (&sv_accelerate); Cvar_RegisterVariable (&sv_airaccelerate); Cvar_RegisterVariable (&sv_wateraccelerate); Cvar_RegisterVariable (&sv_friction); Cvar_RegisterVariable (&sv_waterfriction); Cvar_RegisterVariable (&sv_aim); Cvar_RegisterVariable (&filterban); Cvar_RegisterVariable (&allow_download); Cvar_RegisterVariable (&allow_download_skins); Cvar_RegisterVariable (&allow_download_models); Cvar_RegisterVariable (&allow_download_sounds); Cvar_RegisterVariable (&allow_download_maps); Cvar_RegisterVariable (&sv_highchars); Cvar_RegisterVariable (&sv_phs); Cvar_RegisterVariable (&sv_namedistance); Cvar_RegisterVariable (&sv_ce_scale); Cvar_RegisterVariable (&sv_ce_max_size); Cmd_AddCommand ("addip", SV_AddIP_f); Cmd_AddCommand ("removeip", SV_RemoveIP_f); Cmd_AddCommand ("listip", SV_ListIP_f); Cmd_AddCommand ("writeip", SV_WriteIP_f); for (i = 0; i < MAX_MODELS; i++) sprintf (localmodels[i], "*%i", i); Info_SetValueForStarKey (svs.info, "*version", va("%4.2f", ENGINE_VERSION), MAX_SERVERINFO_STRING); // init fraglog stuff svs.logsequence = 1; svs.logtime = realtime; SZ_Init (&svs.log[0], svs.log_buf[0], sizeof(svs.log_buf[0])); SZ_Init (&svs.log[1], svs.log_buf[1], sizeof(svs.log_buf[1])); svs.log[0].allowoverflow = true; svs.log[1].allowoverflow = true; }
/* =============== SV_Init Only called at startup, not for each game =============== */ void SV_Init( void ) { SV_InitOperatorCommands(); skill = Cvar_Get ("skill", "1", CVAR_LATCH, "game skill level" ); deathmatch = Cvar_Get ("deathmatch", "0", CVAR_LATCH|CVAR_SERVERINFO, "displays deathmatch state" ); teamplay = Cvar_Get ("teamplay", "0", CVAR_LATCH|CVAR_SERVERINFO, "displays teamplay state" ); coop = Cvar_Get ("coop", "0", CVAR_LATCH|CVAR_SERVERINFO, "displays cooperative state" ); Cvar_Get ("protocol", va( "%i", PROTOCOL_VERSION ), CVAR_INIT, "displays server protocol version" ); Cvar_Get ("defaultmap", "", CVAR_SERVERNOTIFY, "holds the multiplayer mapname" ); Cvar_Get ("showtriggers", "0", CVAR_LATCH, "debug cvar shows triggers" ); Cvar_Get ("sv_aim", "0", CVAR_ARCHIVE, "enable auto-aiming" ); Cvar_Get ("mapcyclefile", "mapcycle.txt", 0, "name of multiplayer map cycle configuration file" ); Cvar_Get ("servercfgfile","server.cfg", 0, "name of dedicated server configuration file" ); Cvar_Get ("lservercfgfile","listenserver.cfg", 0, "name of listen server configuration file" ); Cvar_Get ("motdfile", "motd.txt", 0, "name of 'message of the day' file" ); Cvar_Get ("sv_language", "0", 0, "game language (currently unused)" ); Cvar_Get ("suitvolume", "0.25", CVAR_ARCHIVE, "HEV suit volume" ); Cvar_Get ("sv_background", "0", CVAR_READ_ONLY, "indicate what background map is running" ); Cvar_Get( "gamedir", GI->gamefolder, CVAR_SERVERINFO|CVAR_SERVERNOTIFY|CVAR_INIT, "game folder" ); Cvar_Get( "sv_alltalk", "1", 0, "allow to talking for all players (legacy, unused)" ); Cvar_Get( "sv_airmove", "1", CVAR_SERVERNOTIFY, "enable airmovement (legacy, unused)" ); Cvar_Get( "mp_autocrosshair", "0", 0, "allow auto crosshair in multiplayer (legacy, unused)" ); Cvar_Get( "sv_allow_PhysX", "1", CVAR_ARCHIVE, "allow XashXT to usage PhysX engine" ); //XashXT cvar Cvar_Get( "sv_precache_meshes", "1", CVAR_ARCHIVE, "cache SOLID_CUSTOM meshes before level loading" ); // Paranoia 2 cvar Cvar_Get( "mp_allowmonsters", "0", CVAR_SERVERNOTIFY | CVAR_LATCH, "allow auto monsters in multiplayer" ); // half-life shared variables sv_zmax = Cvar_Get ("sv_zmax", "4096", CVAR_PHYSICINFO, "zfar server value" ); sv_wateramp = Cvar_Get ("sv_wateramp", "0", CVAR_PHYSICINFO, "global water wave height" ); sv_skycolor_r = Cvar_Get ("sv_skycolor_r", "255", CVAR_PHYSICINFO, "skycolor red" ); sv_skycolor_g = Cvar_Get ("sv_skycolor_g", "255", CVAR_PHYSICINFO, "skycolor green" ); sv_skycolor_b = Cvar_Get ("sv_skycolor_b", "255", CVAR_PHYSICINFO, "skycolor blue" ); sv_skyvec_x = Cvar_Get ("sv_skyvec_x", "0", CVAR_PHYSICINFO, "skylight direction x" ); sv_skyvec_y = Cvar_Get ("sv_skyvec_y", "0", CVAR_PHYSICINFO, "skylight direction y" ); sv_skyvec_z = Cvar_Get ("sv_skyvec_z", "0", CVAR_PHYSICINFO, "skylight direction z" ); sv_skyname = Cvar_Get ("sv_skyname", "desert", CVAR_PHYSICINFO, "skybox name (can be dynamically changed in-game)" ); sv_skydir_x = Cvar_Get ("sv_skydir_x", "0", CVAR_PHYSICINFO, "sky rotation direction x" ); sv_skydir_y = Cvar_Get ("sv_skydir_y", "0", CVAR_PHYSICINFO, "sky rotation direction y" ); sv_skydir_z = Cvar_Get ("sv_skydir_z", "1", CVAR_PHYSICINFO, "sky rotation direction z" ); // g-cont. add default sky rotate direction sv_skyangle = Cvar_Get ("sv_skyangle", "0", CVAR_PHYSICINFO, "skybox rotational angle (in degrees)" ); sv_skyspeed = Cvar_Get ("sv_skyspeed", "0", 0, "skybox rotational speed" ); sv_footsteps = Cvar_Get ("mp_footsteps", "1", CVAR_PHYSICINFO, "can hear footsteps from other players" ); sv_wateralpha = Cvar_Get ("sv_wateralpha", "1", CVAR_PHYSICINFO, "world surfaces water transparency factor. 1.0 - solid, 0.0 - fully transparent" ); rcon_password = Cvar_Get( "rcon_password", "", 0, "remote connect password" ); sv_stepsize = Cvar_Get( "sv_stepsize", "18", CVAR_ARCHIVE|CVAR_PHYSICINFO, "how high you can step up" ); sv_newunit = Cvar_Get( "sv_newunit", "0", 0, "sets to 1 while new unit is loading" ); hostname = Cvar_Get( "hostname", "unnamed", CVAR_SERVERNOTIFY|CVAR_SERVERNOTIFY|CVAR_ARCHIVE, "host name" ); timeout = Cvar_Get( "timeout", "125", CVAR_SERVERNOTIFY, "connection timeout" ); zombietime = Cvar_Get( "zombietime", "2", CVAR_SERVERNOTIFY, "timeout for clients-zombie (who died but not respawned)" ); sv_pausable = Cvar_Get( "pausable", "1", CVAR_SERVERNOTIFY, "allow players to pause or not" ); sv_allow_studio_attachment_angles = Cvar_Get( "sv_allow_studio_attachment_angles", "0", CVAR_ARCHIVE, "enable calc angles for attachment points (on studio models)" ); sv_allow_rotate_pushables = Cvar_Get( "sv_allow_rotate_pushables", "0", CVAR_ARCHIVE, "let the pushers rotate pushables with included origin-brush" ); sv_validate_changelevel = Cvar_Get( "sv_validate_changelevel", "1", CVAR_ARCHIVE, "test change level for level-designer errors" ); sv_clienttrace = Cvar_Get( "sv_clienttrace", "1", CVAR_SERVERNOTIFY, "scaling factor for client hitboxes" ); sv_wallbounce = Cvar_Get( "sv_wallbounce", "1.0", CVAR_PHYSICINFO, "bounce factor for client with MOVETYPE_BOUNCE" ); sv_spectatormaxspeed = Cvar_Get( "sv_spectatormaxspeed", "500", CVAR_PHYSICINFO, "spectator maxspeed" ); sv_waterfriction = Cvar_Get( "sv_waterfriction", "1", CVAR_PHYSICINFO, "how fast you slow down in water" ); sv_wateraccelerate = Cvar_Get( "sv_wateraccelerate", "10", CVAR_PHYSICINFO, "rate at which a player accelerates to sv_maxspeed while in the water" ); sv_rollangle = Cvar_Get( "sv_rollangle", "0", CVAR_PHYSICINFO, "how much to tilt the view when strafing" ); sv_rollspeed = Cvar_Get( "sv_rollspeed", "200", CVAR_PHYSICINFO, "how much strafing is necessary to tilt the view" ); sv_airaccelerate = Cvar_Get("sv_airaccelerate", "10", CVAR_PHYSICINFO, "player accellerate in air" ); sv_maxvelocity = Cvar_Get( "sv_maxvelocity", "2000", CVAR_PHYSICINFO, "max world velocity" ); sv_gravity = Cvar_Get( "sv_gravity", "800", CVAR_PHYSICINFO, "world gravity" ); sv_maxspeed = Cvar_Get( "sv_maxspeed", "320", CVAR_PHYSICINFO, "maximum speed a player can accelerate to when on ground"); sv_accelerate = Cvar_Get( "sv_accelerate", "10", CVAR_PHYSICINFO, "rate at which a player accelerates to sv_maxspeed" ); sv_friction = Cvar_Get( "sv_friction", "4", CVAR_PHYSICINFO, "how fast you slow down" ); sv_edgefriction = Cvar_Get( "edgefriction", "2", CVAR_PHYSICINFO, "how much you slow down when nearing a ledge you might fall off" ); sv_stopspeed = Cvar_Get( "sv_stopspeed", "100", CVAR_PHYSICINFO, "how fast you come to a complete stop" ); sv_maxclients = Cvar_Get( "maxplayers", "1", CVAR_LATCH|CVAR_SERVERNOTIFY, "server clients limit" ); sv_check_errors = Cvar_Get( "sv_check_errors", "0", CVAR_ARCHIVE, "check edicts for errors" ); physinfo = Cvar_Get( "@physinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only serverinfo = Cvar_Get( "@serverinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only public_server = Cvar_Get ("public", "0", 0, "change server type from private to public" ); sv_lighting_modulate = Cvar_Get( "r_lighting_modulate", "0.6", CVAR_ARCHIVE, "lightstyles modulate scale" ); sv_reconnect_limit = Cvar_Get ("sv_reconnect_limit", "3", CVAR_ARCHIVE, "max reconnect attempts" ); sv_failuretime = Cvar_Get( "sv_failuretime", "0.5", 0, "after this long without a packet from client, don't send any more until client starts sending again" ); sv_unlag = Cvar_Get( "sv_unlag", "1", 0, "allow lag compensation on server-side" ); sv_maxunlag = Cvar_Get( "sv_maxunlag", "0.5", 0, "max latency which can be interpolated" ); sv_unlagpush = Cvar_Get( "sv_unlagpush", "0.0", 0, "unlag push bias" ); sv_unlagsamples = Cvar_Get( "sv_unlagsamples", "1", 0, "max samples to interpolate" ); sv_allow_upload = Cvar_Get( "sv_allow_upload", "1", 0, "allow uploading custom resources from clients" ); sv_allow_download = Cvar_Get( "sv_allow_download", "1", 0, "allow download missed resources to clients" ); sv_send_logos = Cvar_Get( "sv_send_logos", "1", 0, "send custom player decals to other clients" ); sv_send_resources = Cvar_Get( "sv_send_resources", "1", 0, "send generic resources that specified in 'mapname.res'" ); sv_sendvelocity = Cvar_Get( "sv_sendvelocity", "1", CVAR_ARCHIVE, "force to send velocity for event_t structure across network" ); sv_quakehulls = Cvar_Get( "sv_quakehulls", "0", CVAR_ARCHIVE, "using quake style hull select instead of half-life style hull select" ); mp_consistency = Cvar_Get( "mp_consistency", "1", CVAR_SERVERNOTIFY, "enbale consistency check in multiplayer" ); clockwindow = Cvar_Get( "clockwindow", "0.5", 0, "timewindow to execute client moves" ); sv_novis = Cvar_Get( "sv_novis", "0", 0, "force to ignore server visibility" ); SV_ClearSaveDir (); // delete all temporary *.hl files BF_Init( &net_message, "NetMessage", net_message_buffer, sizeof( net_message_buffer )); }
/* * SV_Init * * Only called at plat.exe startup, not for each game */ void SV_Init( void ) { cvar_t *sv_pps; cvar_t *sv_fps; assert( !sv_initialized ); memset( &svc, 0, sizeof( svc ) ); SV_InitOperatorCommands(); sv_mempool = Mem_AllocPool( NULL, "Server" ); Cvar_Get( "sv_cheats", "0", CVAR_SERVERINFO | CVAR_LATCH ); Cvar_Get( "protocol", va( "%i", APP_PROTOCOL_VERSION ), CVAR_SERVERINFO | CVAR_NOSET ); sv_ip = Cvar_Get( "sv_ip", "", CVAR_ARCHIVE | CVAR_LATCH ); sv_port = Cvar_Get( "sv_port", va( "%i", PORT_SERVER ), CVAR_ARCHIVE | CVAR_LATCH ); sv_ip6 = Cvar_Get( "sv_ip6", "::", CVAR_ARCHIVE | CVAR_LATCH ); sv_port6 = Cvar_Get( "sv_port6", va( "%i", PORT_SERVER ), CVAR_ARCHIVE | CVAR_LATCH ); #ifdef TCP_SUPPORT sv_tcp = Cvar_Get( "sv_tcp", "1", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_LATCH ); #endif rcon_password = Cvar_Get( "rcon_password", "", 0 ); sv_hostname = Cvar_Get( "sv_hostname", APPLICATION " server", CVAR_SERVERINFO | CVAR_ARCHIVE ); sv_timeout = Cvar_Get( "sv_timeout", "125", 0 ); sv_zombietime = Cvar_Get( "sv_zombietime", "2", 0 ); sv_enforcetime = Cvar_Get( "sv_enforcetime", "1", 0 ); sv_showclamp = Cvar_Get( "sv_showclamp", "0", 0 ); sv_showRcon = Cvar_Get( "sv_showRcon", "1", 0 ); sv_showChallenge = Cvar_Get( "sv_showChallenge", "0", 0 ); sv_showInfoQueries = Cvar_Get( "sv_showInfoQueries", "0", 0 ); sv_highchars = Cvar_Get( "sv_highchars", "1", 0 ); sv_uploads_baseurl = Cvar_Get( "sv_uploads_baseurl", "", CVAR_ARCHIVE ); sv_uploads_demos_baseurl = Cvar_Get( "sv_uploads_demos_baseurl", "", CVAR_ARCHIVE ); if( dedicated->integer ) { sv_uploads = Cvar_Get( "sv_uploads", "1", CVAR_READONLY ); sv_uploads_from_server = Cvar_Get( "sv_uploads_from_server", "1", CVAR_READONLY ); sv_autoUpdate = Cvar_Get( "sv_autoUpdate", "1", CVAR_ARCHIVE ); sv_pure = Cvar_Get( "sv_pure", "1", CVAR_ARCHIVE | CVAR_LATCH | CVAR_SERVERINFO ); #ifdef PUBLIC_BUILD sv_public = Cvar_Get( "sv_public", "1", CVAR_ARCHIVE | CVAR_LATCH ); #else sv_public = Cvar_Get( "sv_public", "0", CVAR_ARCHIVE | CVAR_LATCH ); #endif } else { sv_uploads = Cvar_Get( "sv_uploads", "1", CVAR_ARCHIVE ); sv_uploads_from_server = Cvar_Get( "sv_uploads_from_server", "1", CVAR_ARCHIVE ); sv_autoUpdate = Cvar_Get( "sv_autoUpdate", "0", CVAR_READONLY ); sv_pure = Cvar_Get( "sv_pure", "0", CVAR_ARCHIVE | CVAR_LATCH | CVAR_SERVERINFO ); sv_public = Cvar_Get( "sv_public", "0", CVAR_ARCHIVE ); } sv_iplimit = Cvar_Get( "sv_iplimit", "3", CVAR_ARCHIVE ); sv_lastAutoUpdate = Cvar_Get( "sv_lastAutoUpdate", "0", CVAR_READONLY|CVAR_ARCHIVE ); sv_pure_forcemodulepk3 = Cvar_Get( "sv_pure_forcemodulepk3", "", CVAR_LATCH ); sv_defaultmap = Cvar_Get( "sv_defaultmap", "wdm1", CVAR_ARCHIVE ); sv_write_defaultmap = Cvar_Get( "sv_write_defaultmap", "0", CVAR_ARCHIVE ); sv_reconnectlimit = Cvar_Get( "sv_reconnectlimit", "3", CVAR_ARCHIVE ); sv_maxclients = Cvar_Get( "sv_maxclients", "8", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_LATCH ); sv_maxmvclients = Cvar_Get( "sv_maxmvclients", "4", CVAR_ARCHIVE | CVAR_SERVERINFO ); Cvar_Get( "sv_modmanifest", "", CVAR_READONLY ); Cvar_ForceSet( "sv_modmanifest", "" ); // fix invalid sv_maxclients values if( sv_maxclients->integer < 1 ) Cvar_FullSet( "sv_maxclients", "1", CVAR_ARCHIVE|CVAR_SERVERINFO|CVAR_LATCH, qtrue ); else if( sv_maxclients->integer > MAX_CLIENTS ) Cvar_FullSet( "sv_maxclients", va( "%i", MAX_CLIENTS ), CVAR_ARCHIVE|CVAR_SERVERINFO|CVAR_LATCH, qtrue ); sv_demodir = Cvar_Get( "sv_demodir", "", CVAR_NOSET ); if( sv_demodir->string[0] && Com_GlobMatch( "*[^0-9a-zA-Z_@]*", sv_demodir->string, qfalse ) ) { Com_Printf( "Invalid demo prefix string: %s\n", sv_demodir->string ); Cvar_ForceSet( "sv_demodir", "" ); } // wsw : jal : cap client's exceding server rules sv_maxrate = Cvar_Get( "sv_maxrate", "0", CVAR_DEVELOPER ); sv_compresspackets = Cvar_Get( "sv_compresspackets", "1", CVAR_DEVELOPER ); sv_skilllevel = Cvar_Get( "sv_skilllevel", "1", CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH ); if( sv_skilllevel->integer > 2 ) Cvar_ForceSet( "sv_skilllevel", "2" ); if( sv_skilllevel->integer < 0 ) Cvar_ForceSet( "sv_skilllevel", "0" ); sv_masterservers = Cvar_Get( "masterservers", DEFAULT_MASTER_SERVERS_IPS, CVAR_LATCH ); sv_debug_serverCmd = Cvar_Get( "sv_debug_serverCmd", "0", CVAR_ARCHIVE ); sv_MOTD = Cvar_Get( "sv_MOTD", "0", CVAR_ARCHIVE ); sv_MOTDFile = Cvar_Get( "sv_MOTDFile", "", CVAR_ARCHIVE ); sv_MOTDString = Cvar_Get( "sv_MOTDString", "", CVAR_ARCHIVE ); SV_MOTD_Update(); // this is a message holder for shared use MSG_Init( &tmpMessage, tmpMessageData, sizeof( tmpMessageData ) ); // init server updates ratio if( dedicated->integer ) sv_pps = Cvar_Get( "sv_pps", "20", CVAR_SERVERINFO|CVAR_NOSET ); else sv_pps = Cvar_Get( "sv_pps", "20", CVAR_SERVERINFO ); svc.snapFrameTime = (int)( 1000 / sv_pps->value ); if( svc.snapFrameTime > 200 ) { // too slow, also, netcode uses a byte Cvar_ForceSet( "sv_pps", "5" ); svc.snapFrameTime = 200; } else if( svc.snapFrameTime < 10 ) { // abusive Cvar_ForceSet( "sv_pps", "100" ); svc.snapFrameTime = 10; } sv_fps = Cvar_Get( "sv_fps", "62", CVAR_NOSET ); svc.gameFrameTime = (int)( 1000 / sv_fps->value ); if( svc.gameFrameTime > svc.snapFrameTime ) { // gamecode can never be slower than snaps svc.gameFrameTime = svc.snapFrameTime; Cvar_ForceSet( "sv_fps", sv_pps->dvalue ); } Com_Printf( "Game running at %i fps. Server transmit at %i pps\n", sv_fps->integer, sv_pps->integer ); //init the master servers list SV_InitMaster(); SV_MM_Init(); ML_Init(); sv_initialized = qtrue; }