2004-08-23 00:15:46 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
This program is free software ; you can redistribute it and / or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation ; either version 2
of the License , or ( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2005-07-03 15:16:20 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-23 00:15:46 +00:00
See the GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
2013-03-31 04:21:08 +00:00
# include "quakedef.h"
2006-05-09 00:02:05 +00:00
# include "netinc.h"
2019-03-23 07:06:37 +00:00
# include "fs.h" //for updates
2019-07-02 04:12:20 +00:00
# ifdef SQL
# include "sv_sql.h"
# endif
2005-12-21 03:07:33 +00:00
# include <sys/types.h>
2004-11-29 01:21:00 +00:00
# ifndef CLIENTONLY
2016-01-18 05:22:07 +00:00
# define Q2EDICT_NUM(i) (q2edict_t*)((char *)ge->edicts+(i)*ge->edict_size)
2004-08-23 00:15:46 +00:00
# define INVIS_CHAR1 12
# define INVIS_CHAR2 (char)138
# define INVIS_CHAR3 (char)160
client_t * host_client ; // current client
2019-03-01 22:39:30 +00:00
void CvarPostfixKMG ( cvar_t * v , char * oldval )
{
double k = 1000 ; //scientific units are in thousands. 10ki is 10*1024.
char * end ;
double f = strtod ( v - > string , & end ) ;
if ( * end & & end [ 1 ] = = ' i ' )
k = 1024 ; //kibi
if ( * end = = ' k ' | | * end = = ' K ' )
f * = k ;
if ( * end = = ' m ' | | * end = = ' M ' )
f * = k * k ;
if ( * end = = ' b ' | | * end = = ' B ' | | * end = = ' g ' | | * end = = ' G ' )
f * = k * k * k ;
v - > ival = f ;
v - > value = f ;
}
2005-04-26 16:04:12 +00:00
// bound the size of the physics time tic
# ifdef SERVERONLY
2016-09-08 19:04:35 +00:00
cvar_t sv_mintic = CVARD ( " sv_mintic " , " 0.013 " , " The minimum interval between running physics frames. " ) ;
2005-04-26 16:04:12 +00:00
# else
2016-09-08 19:04:35 +00:00
cvar_t sv_mintic = CVARD ( " sv_mintic " , " 0 " , " The minimum interval between running physics frames. " ) ; //client builds can think as often as they want.
2005-04-26 16:04:12 +00:00
# endif
2017-08-16 02:14:07 +00:00
cvar_t sv_maxtic = CVARD ( " sv_maxtic " , " 0.1 " , " The maximum interval between running physics frames. If the value is too low, multiple physics interations might be run at a time (based upon sv_limittics). Set to 0 for fixed-interval ticks, which may be required if ODE is used. " ) ; //never run a tick slower than this
2016-09-08 19:04:35 +00:00
cvar_t sv_limittics = CVARD ( " sv_limittics " , " 3 " , " The maximum number of ticks that may be run within a frame, to allow the server to catch up if it stalled or if sv_maxtic is too low. " ) ; //
2009-11-15 03:20:17 +00:00
2017-12-02 22:11:20 +00:00
cvar_t sv_nailhack = CVARD ( " sv_nailhack " , " 1 " , " If set to 1, disables the nail entity networking optimisation. This hack was popularised by qizmo which recommends it for better compression. Also allows clients to interplate nail positions and add trails. " ) ;
2016-09-08 19:04:35 +00:00
cvar_t sv_nopvs = CVARD ( " sv_nopvs " , " 0 " , " Set to 1 to ignore pvs on the server. This can make wallhacks more dangerous, so should only be used for debugging. " ) ;
cvar_t fraglog_public = CVARD ( " fraglog_public " , " 1 " , " Enables support for connectionless fraglog requests " ) ;
cvar_t fraglog_details = CVARD ( " fraglog_details " , " 1 " , " Bitmask \n 1: killer+killee names. \n 2: killer+killee teams \n 4:timestamp. \n 8:killer weapon \n 16:killer+killee guid. \n For compatibility, use 1(vanilla) or 7(mvdsv). " ) ;
2004-08-23 00:15:46 +00:00
2018-10-23 07:09:06 +00:00
cvar_t zombietime = CVARD ( " zombietime " , " 2 " , " Client slots will not be reused for this number of seconds. " ) ; // seconds to sink messages
2018-08-21 18:52:25 +00:00
2019-03-23 07:06:37 +00:00
cvar_t sv_rconlim = CVARFD ( " sv_rconlim " , " 4 " , CVAR_ARCHIVE , " Blocks repeated (invalid) rcon attempts. " ) ;
2018-08-21 18:52:25 +00:00
cvar_t sv_crypt_rcon = CVARFD ( " sv_crypt_rcon " , " " , CVAR_ARCHIVE , " Controls whether the rcon password must be hashed or not. Hashed passwords also partially prevent replay attacks, but does NOT prevent malicious actors from reading the commands/results. \n 0: completely insecure. ONLY allows plain-text passwords. Do not use. \n 1: Mandatory hashing (recommended). \n Empty: Allow either, whether the password is secure or not is purely the client's responsibility/fault. Only use this for comptibility with old clients. " ) ;
cvar_t sv_crypt_rcon_clockskew = CVARFD ( " sv_timestamplen " , " 60 " , CVAR_ARCHIVE , " Limits clock skew to reduce (delayed) replay attacks " ) ;
2004-08-23 00:15:46 +00:00
# ifdef SERVERONLY
2016-09-08 19:04:35 +00:00
cvar_t rcon_password = CVARF ( " rcon_password " , " " , CVAR_NOUNSAFEEXPAND ) ; // password for remote server commands
cvar_t password = CVARF ( " password " , " " , CVAR_NOUNSAFEEXPAND ) ; // password for entering the game
2004-08-23 00:15:46 +00:00
# else
extern cvar_t rcon_password ;
extern cvar_t password ;
# endif
2016-09-08 19:04:35 +00:00
cvar_t spectator_password = CVARF ( " spectator_password " , " " , CVAR_NOUNSAFEEXPAND ) ; // password for entering as a sepctator
2010-07-11 02:22:39 +00:00
2020-04-19 01:23:32 +00:00
cvar_t allow_download = CVARAD ( " allow_download " , " 1 " , /*q3*/ " sv_allowDownload " , " If 1, permits downloading. Set to 0 to unconditionally block *ALL* downloads from this server. You may wish to set sv_dlURL if you wish clients to still be able to download content. " ) ;
2015-06-12 14:44:50 +00:00
cvar_t allow_download_skins = CVARD ( " allow_download_skins " , " 1 " , " 0 blocks downloading of any file in the skins/ directory " ) ;
cvar_t allow_download_models = CVARD ( " allow_download_models " , " 1 " , " 0 blocks downloading of any file in the progs/ or models/ directory " ) ;
cvar_t allow_download_sounds = CVARD ( " allow_download_sounds " , " 1 " , " 0 blocks downloading of any file in the sound/ directory " ) ;
2016-11-20 20:52:41 +00:00
cvar_t allow_download_particles = CVARD ( " allow_download_particles " , " 1 " , " 0 blocks downloading of any file in the particles/ directory " ) ;
2015-06-12 14:44:50 +00:00
cvar_t allow_download_demos = CVARD ( " allow_download_demos " , " 1 " , " 0 blocks downloading of any file in the demos/ directory " ) ;
cvar_t allow_download_maps = CVARD ( " allow_download_maps " , " 1 " , " 0 blocks downloading of any file in the maps/ directory " ) ;
2022-06-06 02:20:49 +00:00
cvar_t allow_download_logs = CVARFD ( " allow_download_logs " , " 0 " , CVAR_NOSET /*cmdline-only*/ | CVAR_WARNONCHANGE , " 1 permits downloading files with the extension .log \n " CON_ERROR " THIS IS DANGEROUS AS IT POTENTIALLY ALLOWS PEOPLE TO SEE PASSWORDS OR OTHER PRIVATE INFORMATION. \n Note that it can be switch on/off via rcon. " ) ;
2022-03-01 02:51:55 +00:00
cvar_t allow_download_anymap = CVARFD ( " allow_download_pakmaps " , " 0 " , CVAR_WARNONCHANGE , " 0: clients may not download map files within the server's packages. \n 1: clients may download such files so long as the package is not deemed copyrighted, for compat with old clients that do not support package downloads. \n 2: client may download such files regardless of copyright state (WARNING! Should never be used!). " ) ;
cvar_t allow_download_pakcontents = CVARFD ( " allow_download_pakcontents " , " 0 " , CVAR_WARNONCHANGE , " 0: clients may not download non-map files within the server's packages. \n 1: clients may download such files so long as the package is not deemed copyrighted, for compat with old clients that do not support package downloads. \n 2: client may download such files regardless of copyright state (WARNING! ONLY for consistency with vanilla QuakeWorld!). " ) ;
cvar_t allow_download_root = CVARFD ( " allow_download_root " , " 0 " , CVAR_WARNONCHANGE , " If set, enables downloading from the root of the gamedir (not the basedir). This setting has a lower priority than extension-based checks. " ) ;
2015-06-12 14:44:50 +00:00
cvar_t allow_download_textures = CVARD ( " allow_download_textures " , " 1 " , " 0 blocks downloading of any file in the textures/ directory " ) ;
2018-09-29 17:31:58 +00:00
cvar_t allow_download_packages = CVARD ( " allow_download_packages " , " 1 " , " if 1, permits downloading files (from root directory or elsewhere) with known package extensions (eg: pak+pk3). Packages with a name starting 'pak' are covered by allow_download_copyrighted as well. " ) ;
2015-06-12 14:44:50 +00:00
cvar_t allow_download_refpackages = CVARD ( " allow_download_refpackages " , " 1 " , " If set to 1, packages that contain files needed during spawn functions will be become 'referenced' and automatically downloaded to clients. \n This cvar should probably not be set if you have large packages that provide replacement pickup models on public servers. \n The path command will show a '(ref)' tag next to packages which clients will automatically attempt to download. " ) ;
cvar_t allow_download_wads = CVARD ( " allow_download_wads " , " 1 " , " 0 blocks downloading of any file in the wads/ directory, or is in the root directory with the extension .wad " ) ;
2022-03-01 02:51:55 +00:00
cvar_t allow_download_configs = CVARFD ( " allow_download_configs " , " 0 " , CVAR_WARNONCHANGE , " 1 allows downloading of config files, either with the extension .cfg or in the subdir configs/. \n " CON_ERROR " THIS IS DANGEROUS AS IT CAN ALLOW PEOPLE TO READ YOUR RCON PASSWORD ETC. " ) ;
2016-09-08 19:04:35 +00:00
cvar_t allow_download_locs = CVARD ( " allow_download_locs " , " 1 " , " 0 blocks downloading of any file in the locs/ directory " ) ;
2022-03-01 02:51:55 +00:00
cvar_t allow_download_copyrighted = CVARFD ( " allow_download_copyrighted " , " 0 " , CVAR_WARNONCHANGE , " 0 blocks download of packages that are considered copyrighted. Specifically, this means packages with a leading 'pak' prefix on the filename. \n If you take your copyrights seriously, you should also set allow_download_pakmaps 0 and allow_download_pakcontents 0. " ) ;
2015-06-12 14:44:50 +00:00
cvar_t allow_download_other = CVARD ( " allow_download_other " , " 0 " , " 0 blocks downloading of any file that was not covered by any of the directory download blocks. " ) ;
2010-07-11 02:22:39 +00:00
2015-06-24 17:59:57 +00:00
extern cvar_t sv_allow_splitscreen ;
2023-01-20 02:14:58 +00:00
# if defined(SUPPORT_ICE) || defined(FTE_TARGET_WEB)
2020-02-11 18:06:10 +00:00
static void QDECL SV_Public_Callback ( struct cvar_s * var , char * oldvalue )
{
2020-03-07 09:00:40 +00:00
char name [ 64 ] , * e ;
COM_ParseOut ( var - > string , name , sizeof ( name ) ) ;
strtol ( name , & e , 0 ) ;
if ( * name & & e = = name ) //failed to read any number out of it.
{
2020-06-12 23:29:58 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , va ( " /%s " , ( * name = = ' / ' ) ? name + 1 : name ) , NA_INVALID , NP_RTC_TLS ) ;
2020-03-07 09:00:40 +00:00
var - > value = var - > ival = 2 ; //so other stuff sees us as holepunched.
}
2023-01-20 02:14:58 +00:00
# ifdef FTE_TARGET_WEB
else if ( var - > ival ) //any kind of public is webrtc public, browsers don't allow more.
# else
2020-03-07 09:00:40 +00:00
else if ( var - > ival = = 2 )
2023-01-20 02:14:58 +00:00
# endif
2020-02-11 18:06:10 +00:00
FTENET_AddToCollection ( svs . sockets , var - > name , " / " , NA_INVALID , NP_RTC_TLS ) ;
else
FTENET_AddToCollection ( svs . sockets , var - > name , " " , NA_INVALID , NP_INVALID ) ;
}
cvar_t sv_public = CVARCD ( " sv_public " , " 0 " , SV_Public_Callback , " -1: Fully blocks all inbound connections. \n 0: Disable subscribing to master servers (for private lan-only games). \n 1: Subscribe to public master servers. Your IP address will be listed publicly. Make sure your Router/NAT+Firewall are set to allow inbound connections. \n 2: Subscribe to a broker master, allowing firewall hole punching. " ) ;
# else
cvar_t sv_public = CVARD ( " sv_public " , " 0 " , " -1: Fully blocks all inbound connections. \n 0: Disable subscribing to master servers (for private lan-only games). \n 1: Subscribe to public master servers. Your IP address will be listed publicly. Make sure your Router/NAT+Firewall are set to allow inbound connections. " ) ;
# endif
2017-09-20 11:27:13 +00:00
cvar_t sv_guidhash = CVARD ( " sv_guidkey " , " " , " If set, clients will calculate their GUID values against this string instead of the server's IP address. This allows consistency between multiple servers (for stats tracking), but do NOT treat the client's GUID as something that is secure. " ) ;
2016-09-08 19:04:35 +00:00
cvar_t sv_serverip = CVARD ( " sv_serverip " , " " , " Set this cvar to the server's public ip address if the server is behind a firewall and cannot detect its own public address. Providing a port is required if the firewall/nat remaps it, but is otherwise optional. " ) ;
2017-05-18 10:24:09 +00:00
cvar_t sv_listen_qw = CVARAFD ( " sv_listen_qw " , " 1 " , " sv_listen " , 0 , " Specifies whether normal clients are allowed to connect. " ) ;
2022-07-28 02:17:16 +00:00
cvar_t sv_listen_nq = CVARD ( " sv_listen_nq " , " 0 " , " Allow new (net)quake clients to connect to the server. \n 0 = don't let them in. \n 1 = allow them in (WARNING: this allows 'qsmurf' DOS attacks). \n 2 = accept (net)quake clients by emulating a challenge (as secure as QW/Q2 but does not fully conform to the NQ protocol). \n You may also need to set net_enable_dtls if you wish for the rerelease's client to connect. " ) ;
2016-09-08 19:04:35 +00:00
cvar_t sv_listen_dp = CVARD ( " sv_listen_dp " , " 0 " , " Allows the server to respond with the DP-specific handshake protocol. \n Warning: this can potentially get confused with quake2, and results in race conditions with both vanilla netquake and quakeworld protocols. \n On the plus side, DP clients can usually be identified correctly, enabling a model+sound limit boost. " ) ;
2017-05-18 10:24:09 +00:00
# ifdef QWOVERQ3
2016-09-08 19:04:35 +00:00
cvar_t sv_listen_q3 = CVAR ( " sv_listen_q3 " , " 0 " ) ;
2017-05-18 10:24:09 +00:00
# endif
2018-06-18 16:44:29 +00:00
cvar_t sv_reconnectlimit = CVARD ( " sv_reconnectlimit " , " 0 " , " Blocks dupe connection within the specified length of time . " ) ;
2020-02-11 18:06:10 +00:00
cvar_t sv_use_dns = CVARD ( " sv_use_dns " , " " , " Performs a reverse-dns lookup in order to report more info about where clients are connecting from. " ) ;
2017-12-28 16:24:50 +00:00
cvar_t sv_reportheartbeats = CVARD ( " sv_reportheartbeats " , " 2 " , " Print a notice each time a heartbeat is sent to a master server. When set to 2, the message will be displayed once. " ) ;
2018-12-28 00:04:36 +00:00
cvar_t sv_heartbeat_interval = CVARD ( " sv_heartbeat_interval " , " 110 " , " Interval between heartbeats. Low values are abusive, high values may cause NAT/ghost issues. " ) ;
2021-04-14 05:21:04 +00:00
cvar_t sv_heartbeat_checks = CVARD ( " sv_heartbeat_checks " , " 1 " , " Report when sv_public 1 fails due to PROBABLE router/NAT issues. " ) ;
2016-09-08 19:04:35 +00:00
cvar_t sv_highchars = CVAR ( " sv_highchars " , " 1 " ) ;
2019-03-12 05:04:27 +00:00
cvar_t sv_maxrate = CVARCD ( " sv_maxrate " , " 50000 " , CvarPostfixKMG , " This controls the maximum number of bytes any indivual player may receive (when not downloading). The individual user's rate will also be controlled by the user's rate cvar. " ) ;
cvar_t sv_maxdrate = CVARAFCD ( " sv_maxdrate " , " 500000 " ,
2019-03-01 22:39:30 +00:00
" sv_maxdownloadrate " , 0 , CvarPostfixKMG , " This cvar controls the maximum number of bytes sent to each player per second while that player is downloading. \n If this cvar is set to 0, there will be NO CAP for download rates (if the user's drate is empty/0 too, then expect really fast+abusive downloads that could potentially be considered denial of service attacks) " ) ;
2018-09-23 19:35:24 +00:00
cvar_t sv_minping = CVARFD ( " sv_minping " , " " , CVAR_SERVERINFO , " Simulate fake lag for any players with a ping under the value specified here. Value is in milliseconds. " ) ;
2016-09-08 19:04:35 +00:00
cvar_t sv_bigcoords = CVARFD ( " sv_bigcoords " , " 1 " , 0 , " Uses floats for coordinates instead of 16bit values. \n Also boosts angle precision, so can be useful even on small maps. \n Affects clients thusly: \n QW: enforces a mandatory protocol extension \n DP: enables DPP7 protocol support \n NQ: uses RMQ protocol (protocol 999). " ) ;
2021-04-14 05:21:04 +00:00
cvar_t sv_calcphs = CVARFD ( " sv_calcphs " , " 2 " , CVAR_MAPLATCH , " Enables culling of sound effects. 0=always skip phs. Sounds are globally broadcast. 1=always generate phs. Sounds are always culled. On large maps the phs will be dumped to disk. 2=On large single-player maps, generation of phs is skipped. Otherwise like option 1. " ) ;
2016-09-08 19:04:35 +00:00
cvar_t sv_showconnectionlessmessages = CVARD ( " sv_showconnectionlessmessages " , " 0 " , " Display a line describing each connectionless message that arrives on the server. Primarily a debugging feature, but also potentially useful to admins. " ) ;
cvar_t sv_cullplayers_trace = CVARFD ( " sv_cullplayers_trace " , " " , CVAR_SERVERINFO , " Attempt to cull player entities using tracelines as an anti-wallhack. " ) ;
cvar_t sv_cullentities_trace = CVARFD ( " sv_cullentities_trace " , " " , CVAR_SERVERINFO , " Attempt to cull non-player entities using tracelines as an extreeme anti-wallhack. " ) ;
cvar_t sv_phs = CVARD ( " sv_phs " , " 1 " , " If 1, do not use the phs. It is generally better to use sv_calcphs instead, and leave this as 1. " ) ;
cvar_t sv_resetparms = CVAR ( " sv_resetparms " , " 0 " ) ;
cvar_t sv_pupglow = CVARFD ( " sv_pupglow " , " " , CVAR_SERVERINFO , " Instructs clients to enable hexen2-style powerup pulsing. " ) ;
2018-01-24 12:13:32 +00:00
# ifdef SV_MASTER
2016-09-08 19:04:35 +00:00
cvar_t sv_master = CVAR ( " sv_master " , " 0 " ) ;
2018-01-24 12:13:32 +00:00
# endif
2016-09-08 19:04:35 +00:00
2019-03-23 07:06:37 +00:00
cvar_t sv_reliable_sound = CVARFD ( " sv_reliable_sound " , " 0 " , 0 , " Causes all sounds to be sent reliably, so they will not be missed due to packetloss. However, this will cause them to be delayed somewhat, and slightly bursty. This can be overriden using the 'rsnd' userinfo setting (either forced on or forced off). Note: this does not affect sounds attached to particle effects. " ) ;
2016-09-08 19:04:35 +00:00
cvar_t sv_gamespeed = CVARAF ( " sv_gamespeed " , " 1 " , " slowmo " , 0 ) ;
2019-03-01 22:39:30 +00:00
cvar_t sv_csqcdebug = CVARD ( " sv_csqcdebug " , " 0 " , " Inject packet size information for data directed to csqc. " ) ;
2020-05-14 15:50:26 +00:00
cvar_t sv_csqc_progname = CVARAF ( " sv_csqc_progname " , " csprogs.dat " , /*dp*/ " csqc_progname " , 0 ) ;
2018-04-15 02:48:23 +00:00
cvar_t pausable = CVAR ( " pausable " , " " ) ;
2016-09-08 19:04:35 +00:00
cvar_t sv_banproxies = CVARD ( " sv_banproxies " , " 0 " , " If enabled, anyone connecting via known proxy software will be refused entry. This should aid with blocking aimbots, but is only reliable for certain public proxies. " ) ;
cvar_t sv_specprint = CVARD ( " sv_specprint " , " 3 " , " Bitfield that controls which player events spectators see when tracking that player. \n &1: spectators will see centerprints. \n &2: spectators will see sprints (pickup messages etc). \n &4: spectators will receive console commands, this is potentially risky. \n Individual spectators can use 'setinfo sp foo' to limit this setting. " ) ;
2020-10-06 03:17:28 +00:00
cvar_t sv_protocol = CVARD ( " sv_protocol " , " " , " Specifies which protocol extensions to force. recognised values: csqc " ) ;
2004-08-23 00:15:46 +00:00
//
// game rules mirrored in svs.info
//
2010-07-11 02:22:39 +00:00
cvar_t fraglimit = CVARF ( " fraglimit " , " " , CVAR_SERVERINFO ) ;
cvar_t timelimit = CVARF ( " timelimit " , " " , CVAR_SERVERINFO ) ;
cvar_t teamplay = CVARF ( " teamplay " , " " , CVAR_SERVERINFO ) ;
cvar_t samelevel = CVARF ( " samelevel " , " " , CVAR_SERVERINFO ) ;
2019-07-16 02:59:12 +00:00
cvar_t sv_playerslots = CVARAD ( " sv_playerslots " , " " ,
2014-03-30 08:55:06 +00:00
" maxplayers " , " Specify maximum number of player/spectator/bot slots, new value takes effect on the next map (this may result in players getting kicked). This should generally be set to maxclients+maxspectators. Leave blank for a default value. \n Maximum value of " STRINGIFY ( MAX_CLIENTS ) " . Values above 16 will result in issues with vanilla NQ clients. Effective values other than 32 will result in issues with vanilla QW clients. " ) ;
2013-10-29 17:38:22 +00:00
cvar_t maxclients = CVARAFD ( " maxclients " , " 8 " ,
" sv_maxclients " , CVAR_SERVERINFO , " Specify the maximum number of players allowed on the server at once. Can be changed mid-map. " ) ;
cvar_t maxspectators = CVARFD ( " maxspectators " , " 8 " , CVAR_SERVERINFO , " Specify the maximum number of spectators allowed on the server at once. Can be changed mid-map. " ) ;
2004-08-23 00:15:46 +00:00
# ifdef SERVERONLY
2010-07-11 02:22:39 +00:00
cvar_t deathmatch = CVARF ( " deathmatch " , " 1 " , CVAR_SERVERINFO ) ; // 0, 1, or 2
2004-08-23 00:15:46 +00:00
# else
2013-03-12 22:35:33 +00:00
cvar_t deathmatch = CVARF ( " deathmatch " , " " , CVAR_SERVERINFO ) ; // 0, 1, or 2
2004-08-23 00:15:46 +00:00
# endif
2010-07-11 02:22:39 +00:00
cvar_t coop = CVARF ( " coop " , " " , CVAR_SERVERINFO ) ;
cvar_t skill = CVARF ( " skill " , " " , CVAR_SERVERINFO ) ; // 0, 1, 2 or 3
cvar_t spawn = CVARF ( " spawn " , " " , CVAR_SERVERINFO ) ;
cvar_t watervis = CVARF ( " watervis " , " " , CVAR_SERVERINFO ) ;
2011-10-27 16:16:29 +00:00
# pragma warningmsg("Remove this some time")
2020-10-26 06:30:35 +00:00
cvar_t allow_skybox = CVARFD ( " allow_skybox " , " " , CVAR_SERVERINFO , " This setting says whether clients should skip writing skybox depth when rendering skyboxes/skydomes. Skipping depth writes is required for halflife, quake2, and quake3 compat, but q1 content generally requires depth masking. Empty uses format-specific defaults. " ) ;
2016-07-12 00:40:13 +00:00
cvar_t sv_allow_splitscreen = CVARFD ( " allow_splitscreen " , " " , CVAR_SERVERINFO , " Specifies whether clients can use splitscreen extensions to dynamically add additional clients. This only affects remote clients and not the built-in client. \n Clients may need to reconnect in order to add seats when this is changed. " ) ;
2013-03-12 22:35:33 +00:00
cvar_t fbskins = CVARF ( " fbskins " , " " , CVAR_SERVERINFO ) ; //to get rid of lame fuhquake fbskins
2010-07-11 02:22:39 +00:00
cvar_t sv_motd [ ] = { CVAR ( " sv_motd1 " , " " ) ,
CVAR ( " sv_motd2 " , " " ) ,
CVAR ( " sv_motd3 " , " " ) ,
CVAR ( " sv_motd4 " , " " ) } ;
cvar_t sv_compatiblehulls = CVAR ( " sv_compatiblehulls " , " 1 " ) ;
2012-11-27 03:23:19 +00:00
cvar_t dpcompat_stats = CVAR ( " dpcompat_stats " , " 0 " ) ;
2010-07-11 02:22:39 +00:00
cvar_t hostname = CVARF ( " hostname " , " unnamed " , CVAR_SERVERINFO ) ;
cvar_t secure = CVARF ( " secure " , " " , CVAR_SERVERINFO ) ;
2004-08-23 00:15:46 +00:00
2013-03-12 22:53:23 +00:00
extern cvar_t sv_nqplayerphysics ;
2004-08-23 00:15:46 +00:00
char cvargroup_serverpermissions [ ] = " server permission variables " ;
char cvargroup_serverinfo [ ] = " serverinfo variables " ;
char cvargroup_serverphysics [ ] = " server physics variables " ;
char cvargroup_servercontrol [ ] = " server control variables " ;
2005-12-21 03:07:33 +00:00
vfsfile_t * sv_fraglogfile ;
2004-08-23 00:15:46 +00:00
2010-05-01 22:47:47 +00:00
void PRH2_SetPlayerClass ( client_t * cl , int classnum , qboolean fromqc ) ;
2020-09-08 05:11:09 +00:00
void SV_DeDupeName ( const char * val , client_t * cl , char * newname , size_t newnamesize ) ;
2004-08-23 00:15:46 +00:00
2014-03-30 08:55:06 +00:00
int nextuserid ;
2004-08-23 00:15:46 +00:00
//============================================================================
qboolean ServerPaused ( void )
{
return sv . paused ;
}
/*
= = = = = = = = = = = = = = = =
SV_Shutdown
Quake calls this before calling Sys_Quit or Sys_Error
= = = = = = = = = = = = = = = =
*/
void SV_Shutdown ( void )
{
2014-12-23 15:26:42 +00:00
SV_Master_Shutdown ( ) ;
2004-08-23 00:15:46 +00:00
if ( sv_fraglogfile )
{
2005-12-21 03:07:33 +00:00
VFS_CLOSE ( sv_fraglogfile ) ;
2004-08-23 00:15:46 +00:00
sv_fraglogfile = NULL ;
}
2014-09-02 02:44:43 +00:00
SV_UnspawnServer ( ) ;
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
2004-08-23 00:15:46 +00:00
if ( sv . mvdrecording )
2016-07-12 00:40:13 +00:00
SV_MVDStop ( MVD_CLOSE_STOPPED , false ) ;
2018-09-01 04:18:08 +00:00
# endif
2004-08-23 00:15:46 +00:00
2012-07-05 19:42:36 +00:00
if ( svs . entstatebuffer . entities )
{
BZ_Free ( svs . entstatebuffer . entities ) ;
memset ( & svs . entstatebuffer . entities , 0 , sizeof ( svs . entstatebuffer . entities ) ) ;
}
if ( sv_staticentities )
{
sv_max_staticentities = 0 ;
sv . num_static_entities = 0 ;
BZ_Free ( sv_staticentities ) ;
sv_staticentities = NULL ;
}
2015-04-14 23:12:17 +00:00
if ( sv_staticsounds )
{
sv_max_staticsounds = 0 ;
sv . num_static_sounds = 0 ;
BZ_Free ( sv_staticsounds ) ;
sv_staticsounds = NULL ;
}
2014-06-30 20:32:34 +00:00
while ( svs . free_lagged_packet )
{
laggedpacket_t * lp = svs . free_lagged_packet ;
svs . free_lagged_packet = lp - > next ;
Z_Free ( lp ) ;
}
2012-07-05 19:42:36 +00:00
2022-01-30 05:55:01 +00:00
# ifdef WEBCLIENT
HTTP_CL_Terminate ( ) ;
# endif
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
2012-11-29 13:37:48 +00:00
T_FreeStrings ( ) ;
2014-09-17 03:04:08 +00:00
# endif
2012-07-05 19:42:36 +00:00
SV_GibFilterPurge ( ) ;
2017-02-11 16:14:06 +00:00
Log_ShutDown ( ) ;
2004-08-23 00:15:46 +00:00
NET_Shutdown ( ) ;
2014-10-05 20:04:11 +00:00
2015-08-02 11:36:46 +00:00
# ifdef PLUGINS
2015-06-14 08:16:15 +00:00
Plug_Shutdown ( true ) ;
2015-08-02 11:36:46 +00:00
# endif
2015-06-14 08:16:15 +00:00
Mod_Shutdown ( true ) ;
2019-07-16 02:59:12 +00:00
# ifdef PACKAGEMANAGER
2020-04-19 01:23:32 +00:00
PM_Shutdown ( false ) ;
2019-07-16 02:59:12 +00:00
# endif
2014-10-05 20:04:11 +00:00
COM_DestroyWorkerThread ( ) ;
2015-06-14 08:16:15 +00:00
FS_Shutdown ( ) ;
2015-08-02 11:36:46 +00:00
# ifdef PLUGINS
2015-06-14 08:16:15 +00:00
Plug_Shutdown ( false ) ;
2015-08-02 11:36:46 +00:00
# endif
2015-06-14 08:16:15 +00:00
Cvar_Shutdown ( ) ;
Cmd_Shutdown ( ) ;
2014-10-05 20:04:11 +00:00
2019-07-16 02:59:12 +00:00
2018-07-05 16:21:44 +00:00
InfoBuf_Clear ( & svs . info , true ) ;
InfoBuf_Clear ( & svs . localinfo , true ) ;
2010-03-14 14:35:56 +00:00
# ifdef WEBSERVER
2004-08-23 00:15:46 +00:00
IWebShutdown ( ) ;
# endif
2008-05-09 14:22:37 +00:00
2014-08-15 02:20:41 +00:00
COM_BiDi_Shutdown ( ) ;
2015-06-14 08:16:15 +00:00
TL_Shutdown ( ) ;
2008-05-09 14:22:37 +00:00
Memory_DeInit ( ) ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = =
SV_Error
Sends a datagram to all the clients informing them of the server crash ,
then exits
= = = = = = = = = = = = = = = =
*/
void VARGS SV_Error ( char * error , . . . )
{
va_list argptr ;
static char string [ 1024 ] ;
static qboolean inerror = false ;
2017-10-31 22:52:58 +00:00
int i ;
2004-08-23 00:15:46 +00:00
if ( inerror )
2004-11-17 17:43:07 +00:00
{
2004-08-23 00:15:46 +00:00
Sys_Error ( " SV_Error: recursively entered (%s) " , string ) ;
2004-11-17 17:43:07 +00:00
}
2004-08-23 00:15:46 +00:00
inerror = true ;
va_start ( argptr , error ) ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string , sizeof ( string ) - 1 , error , argptr ) ;
2004-08-23 00:15:46 +00:00
va_end ( argptr ) ;
2005-06-14 04:52:10 +00:00
{
2005-08-19 19:06:22 +00:00
extern cvar_t pr_ssqc_coreonerror ;
2007-09-02 19:55:17 +00:00
if ( svprogfuncs & & pr_ssqc_coreonerror . value & & svprogfuncs - > save_ents )
2005-08-19 19:06:22 +00:00
{
2015-11-18 07:37:39 +00:00
size_t size = 1024 * 1024 * 8 ;
2005-08-19 19:06:22 +00:00
char * buffer = BZ_Malloc ( size ) ;
2013-08-21 07:14:39 +00:00
svprogfuncs - > save_ents ( svprogfuncs , buffer , & size , size , 3 ) ;
2015-06-04 06:15:14 +00:00
COM_WriteFile ( " ssqccore.txt " , FS_GAMEONLY , buffer , size ) ;
2005-08-19 19:06:22 +00:00
BZ_Free ( buffer ) ;
}
2005-06-14 04:52:10 +00:00
}
2004-08-23 00:15:46 +00:00
SV_EndRedirect ( ) ;
2019-06-05 20:48:06 +00:00
Con_Printf ( CON_ERROR " SV_Error: %s \n " , string ) ;
2004-08-23 00:15:46 +00:00
if ( sv . state )
SV_FinalMessage ( va ( " server crashed: %s \n " , string ) ) ;
2017-10-31 22:52:58 +00:00
//flag all players as unspawned, so gamecode doesn't recurse while already crashing. that sort of thing just results in more crashes.
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
svs . clients [ i ] . spawned = false ;
sv . spawned_client_slots = 0 ;
sv . spawned_observer_slots = 0 ;
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
if ( cls . state )
{
inerror = false ;
Host_EndGame ( " SV_Error: %s \n " , string ) ;
}
2009-11-04 21:16:50 +00:00
SCR_EndLoadingPlaque ( ) ;
2004-08-23 00:15:46 +00:00
if ( ! isDedicated ) //dedicated servers crash...
{
extern jmp_buf host_abort ;
SCR_EndLoadingPlaque ( ) ;
2019-07-16 02:59:12 +00:00
SV_UnspawnServer ( ) ;
2023-08-11 14:03:25 +00:00
CL_Disconnect ( string ) ;
2004-08-23 00:15:46 +00:00
inerror = false ;
longjmp ( host_abort , 1 ) ;
}
# endif
2005-07-03 15:16:20 +00:00
2019-07-16 02:59:12 +00:00
sys_nounload = true ;
SV_UnspawnServer ( ) ;
2004-08-23 00:15:46 +00:00
SV_Shutdown ( ) ;
Sys_Error ( " SV_Error: %s \n " , string ) ;
}
2009-11-18 20:41:30 +00:00
# ifdef SERVERONLY
2018-05-28 10:12:10 +00:00
void VARGS Host_Error ( const char * error , . . . )
2009-11-18 20:41:30 +00:00
{
va_list argptr ;
char string [ 1024 ] ;
va_start ( argptr , error ) ;
vsnprintf ( string , sizeof ( string ) - 1 , error , argptr ) ;
va_end ( argptr ) ;
SV_Error ( " %s " , string ) ;
}
# endif
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
# ifdef SERVERONLY
2018-05-28 10:12:10 +00:00
void VARGS Host_EndGame ( const char * error , . . . )
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
{
va_list argptr ;
char string [ 1024 ] ;
va_start ( argptr , error ) ;
vsnprintf ( string , sizeof ( string ) - 1 , error , argptr ) ;
va_end ( argptr ) ;
SV_Error ( " %s " , string ) ;
}
# endif
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = =
SV_FinalMessage
Used by SV_Error and SV_Quit_f to send a final message to all connected
clients before the server goes down . The messages are sent immediately ,
not just stuck on the outgoing message list , because the server is going
to totally exit after returning from this function .
= = = = = = = = = = = = = = = = = =
*/
void SV_FinalMessage ( char * message )
{
int i ;
client_t * cl ;
2016-07-12 00:40:13 +00:00
sizebuf_t buf ;
char bufdata [ 1024 ] ;
2005-07-03 15:16:20 +00:00
2016-07-12 00:40:13 +00:00
memset ( & buf , 0 , sizeof ( buf ) ) ;
buf . data = bufdata ;
buf . maxsize = sizeof ( bufdata ) ;
2013-10-29 17:38:22 +00:00
for ( i = 0 , cl = svs . clients ; i < svs . allocated_client_slots ; i + + , cl + + )
2021-06-25 18:50:42 +00:00
if ( cl - > state > = cs_spawned & & ! cl - > controlled )
2022-01-16 18:41:44 +00:00
{
if ( ISQWCLIENT ( cl ) )
{
SZ_Clear ( & buf ) ;
MSG_WriteByte ( & buf , svc_print ) ;
MSG_WriteByte ( & buf , PRINT_HIGH ) ;
MSG_WriteString ( & buf , message ) ;
MSG_WriteByte ( & buf , svc_disconnect ) ;
}
# ifdef NQPROT
else if ( ISNQCLIENT ( cl ) )
{
SZ_Clear ( & buf ) ;
2022-08-19 13:30:16 +00:00
MSG_WriteByte ( & buf , svc_print ) ;
2022-01-16 18:41:44 +00:00
MSG_WriteString ( & buf , message ) ;
MSG_WriteByte ( & buf , svc_disconnect ) ;
}
# endif
else
continue ;
Netchan_Transmit ( & cl - > netchan , buf . cursize
, buf . data , 10000 ) ;
}
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = = = = =
SV_DropClient
Called when the player is totally leaving the server , either willingly
or unwillingly . This is NOT called if the entire server is quiting
or crashing .
= = = = = = = = = = = = = = = = = = = = =
*/
void SV_DropClient ( client_t * drop )
{
2015-02-02 08:01:53 +00:00
unsigned int i ;
2007-08-30 20:45:01 +00:00
laggedpacket_t * lp ;
2013-05-03 04:28:08 +00:00
sizebuf_t termmsg ;
char termbuf [ 64 ] ;
2010-12-23 03:55:10 +00:00
/*drop the first in the chain first*/
if ( drop - > controller & & drop - > controller ! = drop )
{
SV_DropClient ( drop - > controller ) ;
return ;
}
2014-05-20 02:23:37 +00:00
if ( ! drop - > controller & & drop - > netchan . remote_address . type ! = NA_INVALID & & drop - > netchan . remote_address . type ! = NA_LOOPBACK )
2004-08-23 00:15:46 +00:00
{
2008-11-09 22:29:28 +00:00
// add the disconnect
2014-03-30 08:55:06 +00:00
if ( drop - > state < cs_connected )
2005-05-26 12:55:34 +00:00
{
2008-11-09 22:29:28 +00:00
switch ( drop - > protocol )
{
case SCP_QUAKE2 :
2023-09-11 09:31:09 +00:00
case SCP_QUAKE2EX :
2008-11-09 22:29:28 +00:00
MSG_WriteByte ( & drop - > netchan . message , svcq2_disconnect ) ;
break ;
case SCP_QUAKEWORLD :
case SCP_NETQUAKE :
2016-07-12 00:40:13 +00:00
case SCP_BJP3 :
2011-10-27 16:16:29 +00:00
case SCP_FITZ666 :
2008-11-09 22:29:28 +00:00
case SCP_DARKPLACES6 :
case SCP_DARKPLACES7 :
MSG_WriteByte ( & drop - > netchan . message , svc_disconnect ) ;
break ;
case SCP_BAD :
break ;
case SCP_QUAKE3 :
break ;
}
2005-05-26 12:55:34 +00:00
}
}
2004-08-23 00:15:46 +00:00
if ( drop - > state = = cs_spawned )
{
2014-03-30 08:55:06 +00:00
# ifdef SVRANKING
2004-08-23 00:15:46 +00:00
if ( drop - > rankid )
{
2014-03-30 08:55:06 +00:00
int j ;
rankstats_t rs ;
2004-08-23 00:15:46 +00:00
if ( Rank_GetPlayerStats ( drop - > rankid , & rs ) )
{
rs . timeonserver + = realtime - drop - > stats_started ;
drop - > stats_started = realtime ;
rs . kills + = drop - > kills ;
rs . deaths + = drop - > deaths ;
rs . flags1 & = ~ ( RANK_CUFFED | RANK_MUTED | RANK_CRIPPLED ) ;
2014-06-25 03:53:11 +00:00
// if (drop->iscuffed==2)
// rs.flags1 |= RANK_CUFFED;
// if (drop->ismuted==2)
// rs.flags1 |= RANK_MUTED;
// if (drop->iscrippled==2)
// rs.flags1 |= RANK_CRIPPLED;
2004-08-23 00:15:46 +00:00
drop - > kills = 0 ;
drop - > deaths = 0 ;
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , drop - > edict ) ;
2011-10-27 16:16:29 +00:00
if ( pr_global_ptrs - > SetChangeParms )
2004-08-23 00:15:46 +00:00
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > SetChangeParms ) ;
2009-11-05 03:07:52 +00:00
for ( j = 0 ; j < NUM_RANK_SPAWN_PARMS ; j + + )
2011-10-27 16:16:29 +00:00
if ( pr_global_ptrs - > spawnparamglobals [ j ] )
rs . parm [ j ] = * pr_global_ptrs - > spawnparamglobals [ j ] ;
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
# if NUM_RANK_SPAWN_PARMS>32
rs . lastseen = time ( NULL ) ;
# endif
2004-08-23 00:15:46 +00:00
Rank_SetPlayerStats ( drop - > rankid , & rs ) ;
}
}
# endif
2014-09-02 02:44:43 +00:00
}
2014-03-30 08:55:06 +00:00
# ifdef SUBSERVERS
2017-05-23 07:03:07 +00:00
SSV_SavePlayerStats ( drop , ( drop - > redirect = = 2 ) ? 1 : 2 ) ;
2014-03-30 08:55:06 +00:00
# endif
2004-08-23 00:15:46 +00:00
# ifdef SVCHAT
SV_WipeChat ( drop ) ;
# endif
2015-05-03 19:57:46 +00:00
if ( sv . world . worldmodel - > loadstate ! = MLS_LOADED )
Con_Printf ( CON_WARNING " Warning: not notifying gamecode about client disconnection due to invalid worldmodel \n " ) ;
else
2005-08-26 22:56:51 +00:00
switch ( svs . gametype )
{
2007-08-07 19:16:32 +00:00
case GT_MAX :
2005-08-26 22:56:51 +00:00
break ;
2017-12-28 16:24:50 +00:00
# ifdef VM_LUA
case GT_LUA :
# endif
2007-09-02 19:55:17 +00:00
case GT_Q1QVM :
2005-08-26 22:56:51 +00:00
case GT_PROGS :
if ( svprogfuncs )
2004-08-23 00:15:46 +00:00
{
2020-04-19 01:23:32 +00:00
SV_DespawnClient ( drop ) ;
2013-03-12 22:57:40 +00:00
drop - > edict = NULL ;
2005-08-26 22:56:51 +00:00
if ( drop - > spawninfo )
Z_Free ( drop - > spawninfo ) ;
drop - > spawninfo = NULL ;
}
break ;
2007-08-07 19:16:32 +00:00
case GT_QUAKE2 :
# ifdef Q2SERVER
if ( ge )
ge - > ClientDisconnect ( drop - > q2edict ) ;
# endif
break ;
case GT_QUAKE3 :
# ifdef Q3SERVER
2022-03-08 05:31:34 +00:00
q3 - > sv . DropClient ( drop ) ;
2009-03-03 01:52:30 +00:00
# endif
break ;
case GT_HALFLIFE :
# ifdef HLSERVER
SVHL_DropClient ( drop ) ;
2007-08-07 19:16:32 +00:00
# endif
break ;
2004-08-23 00:15:46 +00:00
}
2023-01-09 05:11:34 +00:00
SV_Prompt_Clear ( drop ) ;
2010-08-21 22:12:43 +00:00
if ( drop - > centerprintstring )
Z_Free ( drop - > centerprintstring ) ;
drop - > centerprintstring = NULL ;
2013-03-12 22:57:40 +00:00
if ( ! drop - > redirect & & drop - > state > cs_zombie )
2011-09-06 20:53:38 +00:00
{
if ( drop - > spectator )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Spectator \" %s \" removed \n " , drop - > name ) ;
2011-09-06 20:53:38 +00:00
else
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Client \" %s \" removed \n " , drop - > name ) ;
2011-09-06 20:53:38 +00:00
}
2004-08-23 00:15:46 +00:00
2019-05-10 09:31:21 +00:00
# if defined(HAVE_LEGACY) && defined(MVD_RECORDING)
2019-03-12 05:04:27 +00:00
SV_DownloadQueueClear ( drop ) ;
# endif
2004-08-23 00:15:46 +00:00
if ( drop - > download )
{
2005-12-21 03:07:33 +00:00
VFS_CLOSE ( drop - > download ) ;
2004-08-23 00:15:46 +00:00
drop - > download = NULL ;
}
if ( drop - > upload )
{
2005-12-21 03:07:33 +00:00
VFS_CLOSE ( drop - > upload ) ;
2004-08-23 00:15:46 +00:00
drop - > upload = NULL ;
}
* drop - > uploadfn = 0 ;
2021-08-09 23:06:41 +00:00
# ifdef HAVE_CLIENT
2004-08-23 00:15:46 +00:00
if ( drop - > netchan . remote_address . type = = NA_LOOPBACK )
{
2021-06-25 18:50:42 +00:00
if ( drop - > protocol ! = SCP_BAD )
Netchan_Transmit ( & drop - > netchan , 0 , " " , SV_RateForClient ( drop ) ) ;
2011-10-27 16:16:29 +00:00
# ifdef warningmsg
2013-10-08 14:28:11 +00:00
# pragma warningmsg("This means that we may not see the reason we kicked ourselves.")
2011-05-29 04:26:29 +00:00
# endif
2004-08-23 00:15:46 +00:00
drop - > state = cs_free ; //don't do zombie stuff
2021-08-09 23:06:41 +00:00
cls . state = ca_disconnected ;
2014-03-30 08:55:06 +00:00
CL_BeginServerReconnect ( ) ;
2004-08-23 00:15:46 +00:00
}
else
# endif
2022-03-08 05:31:34 +00:00
if ( drop - > protocol = = SCP_BAD )
drop - > state = cs_free ; //skip zombie state for bots.
else if ( drop - > state = = cs_spawned | | drop - > istobeloaded )
2004-08-23 00:15:46 +00:00
{
drop - > state = cs_zombie ; // become free in a few seconds
drop - > connection_started = realtime ; // for zombie timeout
}
2014-03-30 08:55:06 +00:00
else
drop - > state = cs_free ; //skip zombie state if qc couldn't access it anyway.
2004-08-23 00:15:46 +00:00
drop - > istobeloaded = false ;
drop - > old_frags = 0 ;
2005-11-03 23:40:51 +00:00
# ifdef SVRANKING
2004-08-23 00:15:46 +00:00
drop - > kills = 0 ;
drop - > deaths = 0 ;
2005-11-03 23:40:51 +00:00
# endif
2006-01-02 22:33:23 +00:00
drop - > namebuf [ 0 ] = 0 ;
drop - > name = drop - > namebuf ;
2018-07-05 16:21:44 +00:00
InfoBuf_Clear ( & drop - > userinfo , true ) ;
InfoSync_Clear ( & drop - > infosync ) ;
2004-08-23 00:15:46 +00:00
2007-08-30 20:45:01 +00:00
while ( ( lp = drop - > laggedpacket ) )
{
drop - > laggedpacket = lp - > next ;
lp - > next = svs . free_lagged_packet ;
svs . free_lagged_packet = lp ;
}
drop - > laggedpacket_last = NULL ;
2016-07-12 00:40:13 +00:00
drop - > pendingdeltabits = NULL ;
drop - > pendingcsqcbits = NULL ;
2006-02-17 02:51:59 +00:00
if ( drop - > frameunion . frames ) //union of the same sort of structure
2004-08-23 00:15:46 +00:00
{
2006-02-17 02:51:59 +00:00
Z_Free ( drop - > frameunion . frames ) ;
drop - > frameunion . frames = NULL ;
2004-08-23 00:15:46 +00:00
}
2012-02-12 05:18:31 +00:00
if ( drop - > sentents . entities )
{
Z_Free ( drop - > sentents . entities ) ;
memset ( & drop - > sentents . entities , 0 , sizeof ( drop - > sentents . entities ) ) ;
}
2004-08-23 00:15:46 +00:00
2015-02-02 08:01:53 +00:00
for ( i = 0 ; i < MAX_CL_STATS ; i + + )
{
Z_Free ( drop - > statss [ i ] ) ;
drop - > statss [ i ] = NULL ;
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
drop - > csqcactive = false ;
2013-05-03 04:28:08 +00:00
memset ( & termmsg , 0 , sizeof ( termmsg ) ) ;
termmsg . data = termbuf ;
termmsg . maxsize = sizeof ( termbuf ) ;
termmsg . cursize = 0 ;
2014-03-30 08:55:06 +00:00
if ( drop - > netchan . remote_address . type = = NA_LOOPBACK )
{
}
else if ( ISQWCLIENT ( drop ) | | ISNQCLIENT ( drop ) )
2013-05-03 04:28:08 +00:00
{
MSG_WriteByte ( & termmsg , svc_disconnect ) ;
}
else if ( ISQ2CLIENT ( drop ) )
{
MSG_WriteByte ( & termmsg , svcq2_disconnect ) ;
}
else if ( ISQ3CLIENT ( drop ) )
{
}
2015-07-01 23:15:25 +00:00
if ( drop - > netchan . remote_address . type ! = NA_INVALID & & drop - > netchan . message . maxsize )
2013-05-14 12:56:26 +00:00
{
2018-03-05 11:06:12 +00:00
# ifdef NQPROT
if ( drop - > netchan . isnqprotocol & & drop - > netchan . nqunreliableonly ! = 1 )
{ //try and flush the reliables, so they can see why they were kicked.
drop - > netchan . nqunreliableonly = 3 ; //may cause problems if they were loading content. not much we can do about that.
while ( Netchan_Transmit ( & drop - > netchan , 0 , NULL , 10000 ) )
;
}
# endif
2013-05-14 12:56:26 +00:00
//send twice, to cover packetloss a little.
Netchan_Transmit ( & drop - > netchan , termmsg . cursize , termmsg . data , 10000 ) ;
Netchan_Transmit ( & drop - > netchan , termmsg . cursize , termmsg . data , 10000 ) ;
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
NET_DTLS_Disconnect ( svs . sockets , & drop - > netchan . remote_address ) ;
# endif
2013-05-14 12:56:26 +00:00
}
2013-05-03 04:28:08 +00:00
2007-09-02 19:55:17 +00:00
if ( svs . gametype = = GT_PROGS | | svs . gametype = = GT_Q1QVM ) //gamecode should do it all for us.
2006-10-05 22:10:09 +00:00
{
2004-08-23 00:15:46 +00:00
// send notification to all remaining clients
2013-03-31 04:21:08 +00:00
SV_FullClientUpdate ( drop , NULL ) ;
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
2011-06-05 01:36:14 +00:00
SV_MVD_FullClientUpdate ( NULL , drop ) ;
2018-09-01 04:18:08 +00:00
# endif
2006-10-05 22:10:09 +00:00
}
2004-08-23 00:15:46 +00:00
if ( drop - > controlled )
{
drop - > controlled - > controller = NULL ;
2015-07-06 14:47:46 +00:00
drop - > controlled - > protocol = SCP_BAD ; //with the controller dead, make sure we don't try sending anything to it
2004-08-23 00:15:46 +00:00
SV_DropClient ( drop - > controlled ) ;
2010-12-23 03:55:10 +00:00
drop - > controlled = NULL ;
2004-08-23 00:15:46 +00:00
}
}
2005-12-15 19:15:39 +00:00
//====================================================================
typedef struct pinnedmessages_s {
struct pinnedmessages_s * next ;
char setby [ 64 ] ;
char message [ 1024 ] ;
} pinnedmessages_t ;
pinnedmessages_t * pinned ;
qboolean dopinnedload = true ;
void PIN_DeleteOldestMessage ( void ) ;
void PIN_MakeMessage ( char * from , char * msg ) ;
void PIN_LoadMessages ( void )
{
char setby [ 64 ] ;
char message [ 1024 ] ;
int i ;
2009-05-24 10:11:17 +00:00
char * file , * end ;
2005-12-15 19:15:39 +00:00
char * lstart ;
2009-05-24 10:11:17 +00:00
int len ;
2005-12-15 19:15:39 +00:00
dopinnedload = false ;
while ( pinned )
PIN_DeleteOldestMessage ( ) ;
2009-05-24 10:11:17 +00:00
len = FS_LoadFile ( " pinned.txt " , ( void * * ) & file ) ;
2005-12-15 19:15:39 +00:00
if ( ! file )
return ;
2009-05-24 10:11:17 +00:00
end = file + len ;
2006-03-04 15:47:58 +00:00
2005-12-15 19:15:39 +00:00
lstart = file ;
for ( ; ; )
{
2009-05-24 10:11:17 +00:00
while ( lstart < end & & * lstart < = ' ' )
2005-12-15 19:15:39 +00:00
lstart + + ;
2009-05-24 10:11:17 +00:00
for ( i = 0 ; lstart < end & & i < sizeof ( message ) - 1 ; i + + )
2005-12-15 19:15:39 +00:00
{
if ( * lstart = = ' \n ' | | * lstart = = ' \r ' )
break ;
message [ i ] = * lstart + + ;
}
message [ i ] = ' \0 ' ;
2009-05-24 10:11:17 +00:00
while ( lstart < end & & * lstart < = ' ' )
2005-12-15 19:15:39 +00:00
lstart + + ;
2009-05-24 10:11:17 +00:00
for ( i = 0 ; lstart < end & & i < sizeof ( setby ) - 1 ; i + + )
2005-12-15 19:15:39 +00:00
{
if ( * lstart = = ' \n ' | | * lstart = = ' \r ' )
break ;
setby [ i ] = * lstart + + ;
}
setby [ i ] = ' \0 ' ;
if ( ! * setby )
break ;
PIN_MakeMessage ( setby , message ) ;
}
2009-05-24 10:11:17 +00:00
FS_FreeFile ( file ) ;
2005-12-15 19:15:39 +00:00
}
void PIN_SaveMessages ( void )
{
pinnedmessages_t * p ;
2012-09-30 05:52:03 +00:00
vfsfile_t * f ;
2005-12-15 19:15:39 +00:00
2013-03-31 04:21:08 +00:00
f = FS_OpenVFS ( " pinned.txt " , " wb " , FS_GAMEONLY ) ;
2005-12-15 19:15:39 +00:00
if ( ! f )
{
2016-08-25 00:12:14 +00:00
Con_TPrintf ( CON_ERROR " couldn't write to %s \n " , " pinned.txt " ) ;
2005-12-15 19:15:39 +00:00
return ;
}
for ( p = pinned ; p ; p = p - > next )
2012-09-30 05:52:03 +00:00
VFS_PRINTF ( f , " %s \r \n \t %s \r \n \n " , p - > message , p - > setby ) ;
2005-12-15 19:15:39 +00:00
2012-09-30 05:52:03 +00:00
VFS_CLOSE ( f ) ;
2005-12-15 19:15:39 +00:00
}
void PIN_DeleteOldestMessage ( void )
{
2013-03-31 04:21:08 +00:00
pinnedmessages_t * old ;
if ( dopinnedload )
PIN_LoadMessages ( ) ;
old = pinned ;
2006-02-22 23:30:38 +00:00
if ( old )
{
pinned = pinned - > next ;
Z_Free ( old ) ;
}
2005-12-15 19:15:39 +00:00
}
void PIN_MakeMessage ( char * from , char * msg )
{
pinnedmessages_t * p ;
2006-06-02 17:42:36 +00:00
pinnedmessages_t * newp ;
2005-12-15 19:15:39 +00:00
2013-03-31 04:21:08 +00:00
if ( dopinnedload )
PIN_LoadMessages ( ) ;
2006-06-02 17:42:36 +00:00
newp = BZ_Malloc ( sizeof ( pinnedmessages_t ) ) ;
Q_strncpyz ( newp - > setby , from , sizeof ( newp - > setby ) ) ;
Q_strncpyz ( newp - > message , msg , sizeof ( newp - > message ) ) ;
newp - > next = NULL ;
2005-12-15 19:15:39 +00:00
if ( ! pinned )
2006-06-02 17:42:36 +00:00
pinned = newp ;
2005-12-15 19:15:39 +00:00
else
{
for ( p = pinned ; ; p = p - > next )
{
if ( ! p - > next )
{
2006-06-02 17:42:36 +00:00
p - > next = newp ;
2005-12-15 19:15:39 +00:00
break ;
}
}
}
}
void PIN_ShowMessages ( client_t * cl )
{
pinnedmessages_t * p ;
if ( dopinnedload )
PIN_LoadMessages ( ) ;
if ( ! pinned )
return ;
2006-03-04 15:47:58 +00:00
SV_ClientPrintf ( cl , PRINT_HIGH , " \n \n \n " ) ;
2005-12-15 19:15:39 +00:00
for ( p = pinned ; p ; p = p - > next )
{
2006-03-04 15:47:58 +00:00
SV_ClientPrintf ( cl , PRINT_HIGH , " %s \n \n %s \n " , p - > message , p - > setby ) ;
SV_ClientPrintf ( cl , PRINT_HIGH , " \n \n \n " ) ;
2005-12-15 19:15:39 +00:00
}
}
2004-08-23 00:15:46 +00:00
//====================================================================
/*
= = = = = = = = = = = = = = = = = = =
SV_CalcPing
= = = = = = = = = = = = = = = = = = =
*/
2010-02-06 01:25:04 +00:00
int SV_CalcPing ( client_t * cl , qboolean forcecalc )
2004-08-23 00:15:46 +00:00
{
float ping ;
int i ;
int count ;
2018-01-22 19:18:04 +00:00
if ( cl - > controller )
cl = cl - > controller ;
2006-02-17 02:51:59 +00:00
if ( ! cl - > frameunion . frames )
2004-08-23 00:15:46 +00:00
return 0 ;
2023-09-11 09:31:09 +00:00
safeswitch ( cl - > protocol )
2004-08-23 00:15:46 +00:00
{
2013-07-14 12:22:51 +00:00
# ifdef Q2SERVER
2007-08-07 19:16:32 +00:00
case SCP_QUAKE2 :
2023-09-11 09:31:09 +00:00
case SCP_QUAKE2EX :
2013-03-12 22:53:23 +00:00
{
q2client_frame_t * frame ;
ping = 0 ;
count = 0 ;
for ( frame = cl - > frameunion . q2frames , i = 0 ; i < Q2UPDATE_BACKUP ; i + + , frame + + )
{
if ( frame - > ping_time > 0 )
{
ping + = frame - > ping_time ;
count + + ;
}
}
if ( ! count )
return 9999 ;
ping / = count ;
}
return ping ;
2013-07-14 12:22:51 +00:00
# endif
2007-08-07 19:16:32 +00:00
case SCP_QUAKE3 :
break ;
2005-05-27 05:41:07 +00:00
case SCP_DARKPLACES6 :
case SCP_DARKPLACES7 :
2007-08-07 19:16:32 +00:00
case SCP_NETQUAKE :
2016-07-12 00:40:13 +00:00
case SCP_BJP3 :
2011-10-27 16:16:29 +00:00
case SCP_FITZ666 :
2005-05-26 12:55:34 +00:00
case SCP_QUAKEWORLD :
2004-08-23 00:15:46 +00:00
{
2013-03-12 22:53:23 +00:00
register client_frame_t * frame ;
ping = 0 ;
count = 0 ;
for ( frame = cl - > frameunion . frames , i = 0 ; i < UPDATE_BACKUP ; i + + , frame + + )
2005-05-26 12:55:34 +00:00
{
2013-03-12 22:53:23 +00:00
if ( frame - > ping_time > 0 )
{
ping + = frame - > ping_time ;
count + + ;
}
2005-05-26 12:55:34 +00:00
}
2013-03-12 22:53:23 +00:00
if ( ! count )
return 9999 ;
ping / = count ;
2004-08-23 00:15:46 +00:00
}
2005-05-26 12:55:34 +00:00
return ping * 1000 ;
2023-09-11 09:31:09 +00:00
case SCP_BAD :
safedefault :
break ;
2005-05-26 12:55:34 +00:00
}
return 0 ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = = =
SV_FullClientUpdate
2013-03-31 04:21:08 +00:00
Writes all update values to client . use to = NULL to broadcast .
2004-08-23 00:15:46 +00:00
= = = = = = = = = = = = = = = = = = =
*/
2013-03-31 04:21:08 +00:00
void SV_FullClientUpdate ( client_t * client , client_t * to )
2004-08-23 00:15:46 +00:00
{
int i ;
2013-07-13 12:14:32 +00:00
char info [ EXTENDED_INFO_STRING ] ;
2019-06-03 16:18:47 +00:00
sizebuf_t * buf ;
2004-08-23 00:15:46 +00:00
2013-03-31 04:21:08 +00:00
if ( ! to )
{
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
{
2019-07-16 02:59:12 +00:00
SV_FullClientUpdate ( client , & svs . clients [ i ] ) ;
2013-03-31 04:21:08 +00:00
}
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
2013-07-13 12:14:32 +00:00
if ( sv . mvdrecording )
2013-07-14 16:39:21 +00:00
SV_FullClientUpdate ( client , & demo . recorder ) ;
2018-09-01 04:18:08 +00:00
# endif
2013-03-31 04:21:08 +00:00
return ;
}
2013-06-23 02:17:02 +00:00
if ( to - > controller & & to - > controller ! = to )
return ;
2004-08-23 00:15:46 +00:00
i = client - svs . clients ;
2013-06-23 02:17:02 +00:00
if ( i > = to - > max_net_clients )
return ; //most clients will crash if they see too high a player index. some even segfault.
2013-03-31 04:21:08 +00:00
//Sys_Printf("SV_FullClientUpdate: Updated frags for client %d\n", i);
if ( ISQWCLIENT ( to ) )
2004-08-23 00:15:46 +00:00
{
2023-01-26 07:07:53 +00:00
float onservertime ;
2018-07-05 16:21:44 +00:00
unsigned int pext = to - > fteprotocolextensions ;
2014-02-07 08:38:40 +00:00
int ping = SV_CalcPing ( client , false ) ;
if ( ping > 0xffff )
ping = 0xffff ;
2019-06-05 20:48:06 +00:00
buf = ClientReliable_StartWrite ( to , 4 ) ;
2019-06-03 16:18:47 +00:00
MSG_WriteByte ( buf , svc_updatefrags ) ;
MSG_WriteByte ( buf , i ) ;
MSG_WriteShort ( buf , client - > old_frags ) ;
ClientReliable_FinishWrite ( to ) ;
2019-06-05 20:48:06 +00:00
buf = ClientReliable_StartWrite ( to , 4 ) ;
2019-06-03 16:18:47 +00:00
MSG_WriteByte ( buf , svc_updateping ) ;
MSG_WriteByte ( buf , i ) ;
MSG_WriteShort ( buf , ping ) ;
ClientReliable_FinishWrite ( to ) ;
2019-06-05 20:48:06 +00:00
buf = ClientReliable_StartWrite ( to , 3 ) ;
2019-06-03 16:18:47 +00:00
MSG_WriteByte ( buf , svc_updatepl ) ;
MSG_WriteByte ( buf , i ) ;
MSG_WriteByte ( buf , client - > lossage ) ;
ClientReliable_FinishWrite ( to ) ;
2023-01-26 07:07:53 +00:00
onservertime = realtime - client - > connection_started ;
if ( onservertime > sv . time )
onservertime = sv . time ;
2019-06-05 20:48:06 +00:00
buf = ClientReliable_StartWrite ( to , 6 ) ;
2019-06-03 16:18:47 +00:00
MSG_WriteByte ( buf , svc_updateentertime ) ;
MSG_WriteByte ( buf , i ) ;
2023-01-26 07:07:53 +00:00
MSG_WriteFloat ( buf , onservertime ) ;
2019-06-03 16:18:47 +00:00
ClientReliable_FinishWrite ( to ) ;
2004-08-23 00:15:46 +00:00
2019-06-17 04:21:41 +00:00
InfoBuf_ToString ( & client - > userinfo , info , ( pext & PEXT_BIGUSERINFOS ) ? BASIC_INFO_STRING : sizeof ( info ) , basicuserinfos , privateuserinfos , ( pext & PEXT_BIGUSERINFOS ) ? NULL : basicuserinfos , & to - > infosync , & client - > userinfo ) ;
2019-06-05 20:48:06 +00:00
buf = ClientReliable_StartWrite ( to , 7 + strlen ( info ) ) ;
2019-06-03 16:18:47 +00:00
MSG_WriteByte ( buf , svc_updateuserinfo ) ;
MSG_WriteByte ( buf , i ) ;
MSG_WriteLong ( buf , client - > userid ) ;
MSG_WriteString ( buf , info ) ;
ClientReliable_FinishWrite ( to ) ;
2004-08-23 00:15:46 +00:00
}
2013-03-31 04:21:08 +00:00
else if ( ISNQCLIENT ( to ) )
{
int top , bottom , playercolor ;
2018-07-05 16:21:44 +00:00
char * nam = InfoBuf_ValueForKey ( & client - > userinfo , " name " ) ;
2004-08-23 00:15:46 +00:00
2019-06-05 20:48:06 +00:00
buf = ClientReliable_StartWrite ( to , 4 ) ;
2019-06-03 16:18:47 +00:00
MSG_WriteByte ( buf , svc_updatefrags ) ;
MSG_WriteByte ( buf , i ) ;
MSG_WriteShort ( buf , client - > old_frags ) ;
ClientReliable_FinishWrite ( to ) ;
2019-06-05 20:48:06 +00:00
buf = ClientReliable_StartWrite ( to , 3 + strlen ( nam ) ) ;
2019-06-03 16:18:47 +00:00
MSG_WriteByte ( buf , svc_updatename ) ;
MSG_WriteByte ( buf , i ) ;
MSG_WriteString ( buf , nam ) ;
ClientReliable_FinishWrite ( to ) ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
2018-07-05 16:21:44 +00:00
top = atoi ( InfoBuf_ValueForKey ( & client - > userinfo , " topcolor " ) ) ;
bottom = atoi ( InfoBuf_ValueForKey ( & client - > userinfo , " bottomcolor " ) ) ;
2013-03-31 04:21:08 +00:00
top & = 15 ;
if ( top > 13 )
top = 13 ;
bottom & = 15 ;
if ( bottom > 13 )
bottom = 13 ;
playercolor = top * 16 + bottom ;
2004-08-23 00:15:46 +00:00
2019-06-05 20:48:06 +00:00
buf = ClientReliable_StartWrite ( to , 3 ) ;
2019-06-03 16:18:47 +00:00
MSG_WriteByte ( buf , svc_updatecolors ) ;
MSG_WriteByte ( buf , i ) ;
MSG_WriteByte ( buf , playercolor ) ;
ClientReliable_FinishWrite ( to ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
2023-01-09 05:11:34 +00:00
if ( to - > qex )
{
unsigned int s1 , s2 ;
if ( client - > netchan . remote_address . type = = NA_LOOPBACK )
s1 = s2 = 0 ; //host
else
s1 = s2 = - 1 ; //non-playfab connection
MSG_WriteByte ( buf , svcqex_updatesocial ) ;
MSG_WriteByte ( buf , i ) ;
MSG_WriteLong ( buf , s1 ) ;
MSG_WriteLong ( buf , s2 ) ;
}
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
if ( to - > fteprotocolextensions2 & PEXT2_PREDINFO )
{
2018-07-05 16:21:44 +00:00
char * s ;
InfoBuf_ToString ( & client - > userinfo , info , sizeof ( info ) , basicuserinfos , privateuserinfos , NULL , NULL , NULL ) ;
s = va ( " //fui %i \" %s \" \n " , i , info ) ;
2019-06-05 20:48:06 +00:00
buf = ClientReliable_StartWrite ( to , 2 + strlen ( s ) ) ;
2019-06-03 16:18:47 +00:00
ClientReliableWrite_Begin ( to , svc_stufftext , 2 + strlen ( s ) ) ;
ClientReliableWrite_String ( to , s ) ;
ClientReliable_FinishWrite ( to ) ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
}
2004-08-23 00:15:46 +00:00
}
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
CONNECTIONLESS COMMANDS
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2023-02-20 08:35:56 +00:00
const char * SV_ProtocolNameForClient ( client_t * cl )
{
//okay, that failed...
safeswitch ( cl - > protocol )
{
case SCP_QUAKEWORLD :
if ( cl - > fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS )
return " fteqw " ; //changes enough to be significant. assumed to include csqc.
2023-09-11 09:31:09 +00:00
return " qw " ;
2023-02-20 08:35:56 +00:00
case SCP_BAD :
return " bot " ;
case SCP_QUAKE2 :
2023-09-11 09:31:09 +00:00
return " q2 " ;
case SCP_QUAKE2EX :
return " q2ex " ;
2023-02-20 08:35:56 +00:00
case SCP_QUAKE3 :
2023-09-11 09:31:09 +00:00
return " q3 " ;
2023-02-20 08:35:56 +00:00
case SCP_NETQUAKE :
if ( cl - > fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS )
return " ftenq " ; //changes enough to be significant. assumed to include csqc.
if ( cl - > qex )
return " qex " ;
if ( cl - > proquake_angles_hack )
2023-09-11 09:31:09 +00:00
return " pq " ;
return " nq " ;
2023-02-20 08:35:56 +00:00
case SCP_BJP3 :
return " bjp3 " ;
case SCP_FITZ666 :
//this gets messy... probably we should distinguish more
if ( cl - > fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS )
return " ftenq " ; //changes enough to be significant. assumed to include csqc.
if ( cl - > qex )
return " qex " ;
if ( cl - > netchan . netprim . coordtype ! = COORDTYPE_FIXED_13_3 | | cl - > netchan . netprim . anglesize ! = 1 )
return " rmq " ; //while fte tends not to care, most people consider them separate.
return " fitz " ;
case SCP_DARKPLACES6 :
return " dp6 " ;
case SCP_DARKPLACES7 :
return " dp7 " ;
safedefault :
2023-09-11 09:31:09 +00:00
return " unk " ;
2023-02-20 08:35:56 +00:00
}
}
2017-02-11 16:14:06 +00:00
char * SV_PlayerPublicAddress ( client_t * cl )
{ //returns a string containing the client's IP address, as permitted for viewing by other clients.
//if something useful is actually returned, it should be masked.
2023-02-20 08:35:56 +00:00
//we hide it entirely out of private info caution. most nq clients expect a #.#.#.INVALID type address.
//it should be fine to put other stuff here though, we put client version instead, if we know it.
const char * ver = InfoBuf_ValueForKey ( & cl - > userinfo , " *ver " ) ;
const char * prot = SV_ProtocolNameForClient ( cl ) ;
return va ( " prot %s %s " , prot , ver ) ; //something so they can't confuse ip parsing so easily nor pass them off as some other protocol.
2017-02-11 16:14:06 +00:00
}
2023-02-20 08:35:56 +00:00
# define STATUS_OLDSTYLE 0 //equivelent to STATUS_SERVERINFO|STATUS_PLAYERS
2005-10-07 16:48:12 +00:00
# define STATUS_SERVERINFO 1
# define STATUS_PLAYERS 2
# define STATUS_SPECTATORS 4
# define STATUS_SPECTATORS_AS_PLAYERS 8 //for ASE - change only frags: show as "S"
2023-02-20 08:35:56 +00:00
# define STATUS_SHOWTEAMS 16
# define STATUS_QTVLIST 32 //qtv destid "name" "streamid@host:port" numviewers
2023-03-15 18:02:26 +00:00
# define STATUS_LOGININFO 64
2005-10-07 16:48:12 +00:00
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = =
SVC_Status
Responds with all the info that qplug or qspy can see
This message can be up to around 5 k with worst case string lengths .
= = = = = = = = = = = = = = = =
*/
2017-05-18 10:24:09 +00:00
static void SVC_Status ( void )
2004-08-23 00:15:46 +00:00
{
2005-10-07 16:27:40 +00:00
int displayflags ;
2004-08-23 00:15:46 +00:00
int i ;
client_t * cl ;
2005-10-07 16:48:12 +00:00
char * name ;
2004-08-23 00:15:46 +00:00
int ping ;
int top , bottom ;
2005-10-07 16:48:12 +00:00
char frags [ 64 ] ;
2019-09-04 08:32:22 +00:00
char * skin , * team , * botpre , * specpre ;
2023-03-15 18:02:26 +00:00
char junk [ 512 ] ;
int jlen ;
2004-08-23 00:15:46 +00:00
int slots = 0 ;
2005-10-07 16:48:12 +00:00
displayflags = atoi ( Cmd_Argv ( 1 ) ) ;
if ( displayflags = = STATUS_OLDSTYLE )
displayflags = STATUS_SERVERINFO | STATUS_PLAYERS ;
2005-10-07 16:27:40 +00:00
2004-12-08 04:14:52 +00:00
Cmd_TokenizeString ( " status " , false , false ) ;
2013-11-29 14:36:47 +00:00
SV_BeginRedirect ( RD_PACKET , TL_FindLanguage ( " " ) ) ;
2005-10-07 16:48:12 +00:00
if ( displayflags & STATUS_SERVERINFO )
2018-07-05 16:21:44 +00:00
{
char infostr [ 1024 ] ; //FIXME: vanilla limit is 512. we should probably have a list of known cvars for lower priority sending.
const char * ignorekeys [ ] = { " mapname " , " *z_ext " , NULL } ; //ignore some pointless stuff
const char * prioritykeys [ ] = { " hostname " , " admin " , " *gamedir " , " *version " , " deathmatch " , " timelimit " , " fraglimit " , " maxclients " , " maxspectators " , " status " , NULL } ; //make sure we include these before we start overflowing
InfoBuf_ToString ( & svs . info , infostr , sizeof ( infostr ) , prioritykeys , ignorekeys , NULL , NULL , NULL ) ;
Con_Printf ( " %s \n " , infostr ) ;
}
2013-12-02 14:30:30 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
2004-08-23 00:15:46 +00:00
{
cl = & svs . clients [ i ] ;
2005-10-07 16:48:12 +00:00
if ( ( cl - > state = = cs_connected | | cl - > state = = cs_spawned | | cl - > name [ 0 ] ) & & ( ( cl - > spectator & & displayflags & STATUS_SPECTATORS ) | | ( ! cl - > spectator & & displayflags & STATUS_PLAYERS ) ) )
2004-08-23 00:15:46 +00:00
{
2018-07-05 16:21:44 +00:00
top = atoi ( InfoBuf_ValueForKey ( & cl - > userinfo , " topcolor " ) ) ;
bottom = atoi ( InfoBuf_ValueForKey ( & cl - > userinfo , " bottomcolor " ) ) ;
2004-08-23 00:15:46 +00:00
top = ( top < 0 ) ? 0 : ( ( top > 13 ) ? 13 : top ) ;
bottom = ( bottom < 0 ) ? 0 : ( ( bottom > 13 ) ? 13 : bottom ) ;
2010-02-06 01:25:04 +00:00
ping = SV_CalcPing ( cl , false ) ;
2005-10-07 16:48:12 +00:00
name = cl - > name ;
2018-07-05 16:21:44 +00:00
skin = InfoBuf_ValueForKey ( & cl - > userinfo , " skin " ) ;
team = InfoBuf_ValueForKey ( & cl - > userinfo , " team " ) ;
2015-06-18 22:11:30 +00:00
2015-04-14 23:12:17 +00:00
if ( ! cl - > state | | cl - > protocol = = SCP_BAD ) //show bots differently. Just to be courteous.
2015-06-18 22:11:30 +00:00
botpre = " BOT: " ;
2004-08-23 00:15:46 +00:00
else
2015-06-18 22:11:30 +00:00
botpre = " " ;
2019-09-04 08:32:22 +00:00
specpre = " " ;
2015-06-18 22:11:30 +00:00
if ( cl - > spectator )
{ //silly mvdsv stuff
if ( displayflags & STATUS_SPECTATORS_AS_PLAYERS )
{
frags [ 0 ] = ' S ' ;
frags [ 1 ] = ' \0 ' ;
2005-10-07 16:48:12 +00:00
}
else
2015-06-18 22:11:30 +00:00
{
ping = - ping ;
sprintf ( frags , " %i " , - 9999 ) ;
2019-09-04 08:32:22 +00:00
specpre = " \\ s \\ " ;
2015-06-18 22:11:30 +00:00
}
}
else
sprintf ( frags , " %i " , cl - > old_frags ) ;
2005-10-07 16:48:12 +00:00
2023-03-15 18:02:26 +00:00
junk [ jlen = 0 ] = 0 ;
if ( ( displayflags & STATUS_SHOWTEAMS ) & & jlen + 4 < sizeof ( junk ) )
2015-06-18 22:11:30 +00:00
{
2023-03-15 18:02:26 +00:00
junk [ jlen + + ] = ' ' ;
jlen + = strlen ( COM_QuotedString ( team , junk + jlen , sizeof ( junk ) - jlen , false ) ) ;
2015-06-18 22:11:30 +00:00
}
2023-03-15 18:02:26 +00:00
if ( ( displayflags & STATUS_LOGININFO ) & & jlen + 4 < sizeof ( junk ) )
2015-06-18 22:11:30 +00:00
{
2023-03-15 18:02:26 +00:00
junk [ jlen + + ] = ' ' ;
jlen + = strlen ( COM_QuotedString ( " " , junk + jlen , sizeof ( junk ) - jlen , false ) ) ;
2005-10-07 16:48:12 +00:00
}
2023-03-15 18:02:26 +00:00
Con_Printf ( " %i %s %i %i \" %s%s%s \" \" %s \" %i %i%s \n " , cl - > userid ,
frags , ( int ) ( realtime - cl - > connection_started ) / 60 ,
ping , specpre , botpre , name , skin , top , bottom , junk ) ;
2004-08-23 00:15:46 +00:00
}
else
slots + + ;
}
2019-05-10 09:31:21 +00:00
# ifdef MVD_RECORDING
if ( displayflags & STATUS_QTVLIST )
{
struct mvddest_s * d ;
for ( d = demo . dest ; d ; d = d - > nextdest )
{
if ( d - > desttype = = DEST_STREAM )
Con_Printf ( " qtv %d \" %s \" \" %s \" %d \n " , d - > id , d - > simplename , d - > filename , 0 /*d->viewercount*/ ) ;
}
}
# endif
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
SV_EndRedirect ( ) ;
}
2017-11-15 12:38:20 +00:00
# if 1 //def NQPROT
2022-07-28 02:17:27 +00:00
const char * SV_GetProtocolVersionString ( void )
{
char * ret = va ( " %i " , com_protocolversion . ival ) ; //for compat with DP, this is basically locked at 3. our pexts allow this to be mostly graceful.
switch ( svs . gametype )
{
case GT_PROGS :
case GT_Q1QVM :
if ( sv_listen_qw . ival )
Q_strncatz ( ret , " w " , 64 ) ;
# ifdef NQPROT
if ( progstype = = PROG_H2 )
break ; //don't advertise nq protocols when they're blocked.
if ( sv_listen_nq . ival )
{
Q_strncatz ( ret , " n " , 64 ) ;
# ifdef HAVE_DTLS
if ( * dtls_psk_user . string )
Q_strncatz ( ret , " x " , 64 ) ;
# endif
}
if ( sv_listen_dp . ival )
Q_strncatz ( ret , " d " , 64 ) ;
# endif
break ;
default :
break ; //these do their own thing, with their own protocols. don't be weird.
}
return ret ;
}
2021-04-14 05:21:04 +00:00
static void SVC_GetInfo ( const char * challenge , int fullstatus )
2005-05-26 12:55:34 +00:00
{
//dpmaster support
2009-04-01 22:03:56 +00:00
char response [ MAX_UDP_PACKET ] ;
2017-01-13 00:39:50 +00:00
char protocolname [ MAX_QPATH ] ;
2005-05-26 12:55:34 +00:00
client_t * cl ;
int numclients = 0 ;
int i ;
char * resp ;
2014-03-30 08:55:06 +00:00
const char * gamestatus ;
2009-04-01 22:03:56 +00:00
eval_t * v ;
2005-05-26 12:55:34 +00:00
2017-11-15 12:38:20 +00:00
# ifdef NQPROT
2012-01-28 10:30:44 +00:00
if ( ! sv_listen_nq . ival & & ! sv_listen_dp . ival )
return ;
2017-11-15 12:38:20 +00:00
# endif
2012-01-28 10:30:44 +00:00
2013-12-02 14:30:30 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
2005-05-26 12:55:34 +00:00
{
cl = & svs . clients [ i ] ;
if ( ( cl - > state = = cs_connected | | cl - > state = = cs_spawned | | cl - > name [ 0 ] ) & & ! cl - > spectator )
numclients + + ;
}
2009-04-01 22:03:56 +00:00
if ( svprogfuncs )
{
2011-05-20 04:10:46 +00:00
v = PR_FindGlobal ( svprogfuncs , " worldstatus " , PR_ANY , NULL ) ;
2009-04-01 22:03:56 +00:00
if ( v )
gamestatus = PR_GetString ( svprogfuncs , v - > string ) ;
else
gamestatus = " " ;
}
else
gamestatus = " " ;
2017-02-11 16:14:06 +00:00
COM_ParseOut ( com_protocolname . string , protocolname , sizeof ( protocolname ) ) ; //we can only report one, so report the first.
2009-04-01 22:03:56 +00:00
resp = response ;
//response packet header
* resp + + = 0xff ;
* resp + + = 0xff ;
* resp + + = 0xff ;
* resp + + = 0xff ;
if ( fullstatus )
Q_strncpyz ( resp , " statusResponse " , sizeof ( response ) - ( resp - response ) - 1 ) ;
else
Q_strncpyz ( resp , " infoResponse " , sizeof ( response ) - ( resp - response ) - 1 ) ;
resp + = strlen ( resp ) ;
* resp + + = ' \n ' ;
2018-07-05 16:21:44 +00:00
//first line contains the serverinfo, or some form of it
{
const char * ignorekeys [ ] = {
" maxclients " , " map " , " *gamedir " , " *z_ext " , //this is a DP protocol query, so some QW fields are not needed
" gamename " , " modname " , " protocol " , " clients " , " sv_maxclients " , " mapname " , " qcstatus " , " challenge " , NULL } ; //and we need to add some
const char * prioritykeys [ ] = { " hostname " , NULL } ; //make sure we include these before we start overflowing
* resp = 0 ;
Info_SetValueForKey ( resp , " challenge " , challenge , sizeof ( response ) - ( resp - response ) ) ; //the challenge can be important for the master protocol to prevent poisoning
Info_SetValueForKey ( resp , " gamename " , protocolname , sizeof ( response ) - ( resp - response ) ) ; //distinguishes it from other types of games
2022-07-28 02:17:27 +00:00
Info_SetValueForKey ( resp , " protocol " , SV_GetProtocolVersionString ( ) , sizeof ( response ) - ( resp - response ) ) ;
2018-07-05 16:21:44 +00:00
Info_SetValueForKey ( resp , " modname " , FS_GetGamedir ( true ) , sizeof ( response ) - ( resp - response ) ) ;
Info_SetValueForKey ( resp , " clients " , va ( " %d " , numclients ) , sizeof ( response ) - ( resp - response ) ) ;
Info_SetValueForKey ( resp , " sv_maxclients " , maxclients . string , sizeof ( response ) - ( resp - response ) ) ;
Info_SetValueForKey ( resp , " mapname " , InfoBuf_ValueForKey ( & svs . info , " map " ) , sizeof ( response ) - ( resp - response ) ) ;
resp + = strlen ( resp ) ;
2019-07-16 02:59:12 +00:00
//now include the full/regular serverinfo
2018-07-05 16:21:44 +00:00
resp + = InfoBuf_ToString ( & svs . info , resp , sizeof ( response ) - ( resp - response ) , prioritykeys , ignorekeys , NULL , NULL , NULL ) ;
* resp = 0 ;
//and any possibly-long qc status string
if ( * gamestatus )
Info_SetValueForKey ( resp , " qcstatus " , gamestatus , sizeof ( response ) - ( resp - response ) ) ;
resp + = strlen ( resp ) ;
}
* resp + + = 0 ;
2009-04-01 22:03:56 +00:00
if ( fullstatus )
{
client_t * cl ;
char * start = resp ;
if ( resp ! = response + sizeof ( response ) )
{
resp [ - 1 ] = ' \n ' ; //replace the null terminator that we already wrote
//on the following lines we have an entry for each client
2013-12-02 14:30:30 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
2009-04-01 22:03:56 +00:00
{
cl = & svs . clients [ i ] ;
if ( ( cl - > state = = cs_connected | | cl - > state = = cs_spawned | | cl - > name [ 0 ] ) & & ! cl - > spectator )
{
Q_strncpyz ( resp , va (
" %d %d \" %s \" \" %s \" \n "
,
cl - > old_frags ,
2010-02-06 01:25:04 +00:00
SV_CalcPing ( cl , false ) ,
2009-04-01 22:03:56 +00:00
cl - > team ,
cl - > name
) , sizeof ( response ) - ( resp - response ) ) ;
resp + = strlen ( resp ) ;
}
}
* resp + + = 0 ; //this might not be a null
if ( resp = = response + sizeof ( response ) )
{
//we're at the end of the buffer, it's full. bummer
//replace 12 bytes with infoResponse
memcpy ( response + 4 , " infoResponse " , 12 ) ;
//move down by len(statusResponse)-len(infoResponse) bytes
memmove ( response + 4 + 12 , response + 4 + 14 , resp - response - ( 4 + 14 ) ) ;
start - = 14 - 12 ; //fix this pointer
resp = start ;
resp [ - 1 ] = 0 ; //reset the \n
}
}
}
2005-05-26 12:55:34 +00:00
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , resp - response , response , & net_from ) ;
2005-05-26 12:55:34 +00:00
}
2005-07-03 15:16:20 +00:00
# endif
2005-05-26 12:55:34 +00:00
2005-07-03 15:16:20 +00:00
# ifdef Q2SERVER
2017-05-18 10:24:09 +00:00
static void SVC_InfoQ2 ( void )
2004-08-23 00:15:46 +00:00
{
2018-03-24 04:02:09 +00:00
char string [ 128 ] ;
2004-08-23 00:15:46 +00:00
int i , count ;
int version ;
if ( maxclients . value = = 1 )
return ; // ignore in single player
version = atoi ( Cmd_Argv ( 1 ) ) ;
if ( version ! = PROTOCOL_VERSION_Q2 )
2006-03-06 01:41:09 +00:00
snprintf ( string , sizeof ( string ) , " %s: wrong version \n " , hostname . string ) ;
2004-08-23 00:15:46 +00:00
else
{
count = 0 ;
2013-12-02 14:30:30 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
2004-08-23 00:15:46 +00:00
if ( svs . clients [ i ] . state > = cs_connected )
count + + ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
snprintf ( string , sizeof ( string ) , " %16s %8s %2i/%2i \n " , hostname . string , svs . name , count , ( int ) maxclients . value ) ;
2004-08-23 00:15:46 +00:00
}
2013-05-03 04:28:08 +00:00
Netchan_OutOfBandPrint ( NS_SERVER , & net_from , " info \n %s " , string ) ;
2004-08-23 00:15:46 +00:00
}
2005-07-03 15:16:20 +00:00
# endif
2004-08-23 00:15:46 +00:00
2019-06-17 04:21:41 +00:00
# ifdef MVD_RECORDING
static void SVC_QTVUsers ( void )
{
}
# endif
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = = =
SV_CheckLog
= = = = = = = = = = = = = = = = = = =
*/
# define LOG_FLUSH 10*60
2017-05-18 10:24:09 +00:00
static void SV_CheckLog ( void )
2004-08-23 00:15:46 +00:00
{
sizebuf_t * sz ;
2014-04-24 01:53:01 +00:00
sz = & svs . log [ svs . logsequence & ( FRAGLOG_BUFFERS - 1 ) ] ;
2004-08-23 00:15:46 +00:00
2014-04-24 01:53:01 +00:00
// bump sequence ten minutes have passed and
2004-08-23 00:15:46 +00:00
// there is something still sitting there
2014-04-24 01:53:01 +00:00
//logfrag does the rotation for a full log.
if ( realtime - svs . logtime > LOG_FLUSH & & sz - > cursize )
2004-08-23 00:15:46 +00:00
{
// swap buffers and bump sequence
svs . logtime = realtime ;
svs . logsequence + + ;
2014-04-24 01:53:01 +00:00
sz = & svs . log [ svs . logsequence & ( FRAGLOG_BUFFERS - 1 ) ] ;
2004-08-23 00:15:46 +00:00
sz - > cursize = 0 ;
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " beginning fraglog sequence %i \n " , svs . logsequence ) ;
2004-08-23 00:15:46 +00:00
}
}
/*
= = = = = = = = = = = = = = = =
SVC_Log
Responds with all the logged frags for ranking programs .
If a sequence number is passed as a parameter and it is
the same as the current sequence , an A2A_NACK will be returned
instead of the data .
= = = = = = = = = = = = = = = =
*/
2017-05-18 10:24:09 +00:00
static void SVC_Log ( void )
2004-08-23 00:15:46 +00:00
{
2014-04-24 01:53:01 +00:00
unsigned int seq ;
2004-08-23 00:15:46 +00:00
char data [ MAX_DATAGRAM + 64 ] ;
2008-06-08 14:37:57 +00:00
char adr [ MAX_ADR_SIZE ] ;
2014-09-20 04:11:39 +00:00
char * av ;
2004-08-23 00:15:46 +00:00
2014-09-20 04:11:39 +00:00
av = Cmd_Argv ( 1 ) ;
if ( * av )
2014-04-24 01:53:01 +00:00
{
2014-09-20 04:11:39 +00:00
seq = strtoul ( av , NULL , 0 ) ;
2014-04-24 01:53:01 +00:00
//seq is the last one that the client already has
if ( seq < svs . logsequence - ( FRAGLOG_BUFFERS - 1 ) )
seq = svs . logsequence - ( FRAGLOG_BUFFERS - 1 ) ; //send them this sequence
else if ( seq = = svs . logsequence )
{ //current log isn't available as its not complete yet.
data [ 0 ] = A2A_NACK ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , 1 , data , & net_from ) ;
2014-04-24 01:53:01 +00:00
return ;
}
else if ( seq > svs . logsequence ) //future logs are not valid either. reply with the last that was. this is for compat, just in case.
seq = svs . logsequence - 1 ;
else
seq = seq + 1 ; //they will get the next sequence from the one they already have
}
2004-08-23 00:15:46 +00:00
else
2021-07-17 15:10:10 +00:00
seq = svs . logsequence - 1 ;
2004-08-23 00:15:46 +00:00
2014-04-24 01:53:01 +00:00
if ( ! fraglog_public . ival )
2021-07-17 15:10:10 +00:00
{ //frag logs are not public (for DoS protection perhaps?)
2004-08-23 00:15:46 +00:00
data [ 0 ] = A2A_NACK ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , 1 , data , & net_from ) ;
2004-08-23 00:15:46 +00:00
return ;
}
2014-04-24 01:53:01 +00:00
Con_DPrintf ( " sending log %i to %s \n " , seq , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
2004-08-23 00:15:46 +00:00
2014-09-20 04:11:39 +00:00
//cookie support, to avoid spoofing
av = Cmd_Argv ( 2 ) ;
if ( * av )
Q_snprintfz ( data , sizeof ( data ) , " stdlog %i %s \n %s " , seq , av , ( char * ) svs . log_buf [ seq & ( FRAGLOG_BUFFERS - 1 ) ] ) ;
else
Q_snprintfz ( data , sizeof ( data ) , " stdlog %i \n %s " , seq , ( char * ) svs . log_buf [ seq & ( FRAGLOG_BUFFERS - 1 ) ] ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , strlen ( data ) + 1 , data , & net_from ) ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = =
SVC_Ping
Just responds with an acknowledgement
= = = = = = = = = = = = = = = =
*/
void SVC_Ping ( void )
{
char data ;
data = A2A_ACK ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , 1 , & data , & net_from ) ;
2004-08-23 00:15:46 +00:00
}
2005-05-26 12:55:34 +00:00
//from net_from
int SV_NewChallenge ( void )
{
int i ;
int oldest ;
int oldestTime ;
oldest = 0 ;
oldestTime = 0x7fffffff ;
// see if we already have a challenge for this ip
for ( i = 0 ; i < MAX_CHALLENGES ; i + + )
{
2013-05-03 04:28:08 +00:00
if ( NET_CompareBaseAdr ( & net_from , & svs . challenges [ i ] . adr ) )
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
{
svs . challenges [ i ] . time = realtime ;
2005-05-26 12:55:34 +00:00
return svs . challenges [ i ] . challenge ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
}
2005-05-26 12:55:34 +00:00
if ( svs . challenges [ i ] . time < oldestTime )
{
oldestTime = svs . challenges [ i ] . time ;
oldest = i ;
}
}
// overwrite the oldest
svs . challenges [ oldest ] . challenge = ( rand ( ) < < 16 ) ^ rand ( ) ;
svs . challenges [ oldest ] . adr = net_from ;
svs . challenges [ oldest ] . time = realtime ;
return svs . challenges [ oldest ] . challenge ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = =
SVC_GetChallenge
Returns a challenge number that can be used
in a subsequent client_connect command .
We do this to prevent denial of service attacks that
flood the server with invalid connection IPs . With a
challenge , they must give a valid IP address .
= = = = = = = = = = = = = = = = =
*/
2017-05-18 10:24:09 +00:00
qboolean SVC_GetChallenge ( qboolean respond_dp )
2004-08-23 00:15:46 +00:00
{
# ifdef HUFFNETWORK
int compressioncrc ;
# endif
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
int challenge ;
char * buf ;
int lng ;
char * over ;
2004-08-23 00:15:46 +00:00
2017-05-18 10:24:09 +00:00
qboolean respond_std = true ;
# ifdef QWOVERQ3
qboolean respond_qwoverq3 = true ;
respond_qwoverq3 & = ! ! sv_listen_q3 . value ;
# else
const qboolean respond_qwoverq3 = false ;
# endif
2008-11-09 22:29:28 +00:00
2022-07-28 02:17:27 +00:00
//ioq3clchallenge = atoi(Cmd_Argv(1));
const char * protocols = Cmd_Argv ( 2 ) ;
if ( * protocols )
{
const char * pname ;
char tprot [ 64 ] , oprot [ 64 ] ;
while ( ( protocols = COM_ParseOut ( protocols , tprot , sizeof ( tprot ) ) ) )
{
pname = com_protocolname . string ;
while ( ( pname = COM_ParseOut ( pname , oprot , sizeof ( oprot ) ) ) )
{
if ( ! strcmp ( tprot , oprot ) )
break ;
}
if ( pname )
break ;
}
if ( ! protocols )
{
COM_ParseOut ( com_protocolname . string , oprot , sizeof ( oprot ) ) ;
pname = va ( " print \n Game mismatch: This is a %s server \n " , oprot ) ;
Netchan_OutOfBand ( NS_SERVER , & net_from , strlen ( pname ) , pname ) ;
return false ;
}
}
2017-08-14 16:38:44 +00:00
if ( sv_listen_qw . value & & ! sv_listen_dp . value )
{
respond_std = true ;
respond_dp = false ;
}
else if ( sv_listen_dp . value & & ! sv_listen_qw . value )
{
respond_std = false ;
respond_dp = true ;
}
else
{
respond_std & = ! ! sv_listen_qw . value ;
respond_dp & = ! ! sv_listen_dp . value ;
}
2017-05-18 10:24:09 +00:00
if ( progstype = = PROG_H2 )
respond_dp = false ; //don't bother. dp doesn't support the maps anyway.
//dp's connections result in race conditions or are ambiguous in certain regards
//race: dp vs nq.
// the dp request will generally arrive first. we check if there was a recent challenge requested, and inhibit the nq response, ensuring that dp clients connect with a known protocol
//race: dp vs qw.
// DP clients will just bindly respond to both with a connection request. sending the dp one usually means the server will see the dp connection request first
// FTE clients explicitly ignore dp challenges with the specific 'FTE' prefix so you get qw connections there.
//conflict: dp vs q2. dp challenge responses USUALLY contain letters. vanilla q2 is always a 32bit int. FTE clients will check that before sending an appropriate response.
//so:
// vanilla nq doesn't send getchallenge, its nq connect is not inhibited, and connects directly (we optionally hack a challenge over stuffcmds, as well as protocol extensions).
// dp gets a dp+qw challenge, its nq request is ignored due to packet ordering and a small timeout, the server sees the dp connection request first and ignores the qw connect.
// fte's nq request is treated as a getchallenge. fte clients ignore the dp challenge response (if qw protocols are still enabled). ends up with a qw/fte connection
if ( ! ( sv_listen_nq . value | | sv_bigcoords . value | | ! respond_std ) )
respond_dp = false ;
# ifdef QWOVERQ3
if ( svs . gametype ! = GT_PROGS & & svs . gametype ! = GT_Q1QVM )
respond_qwoverq3 = false ; //should probably just nuke this feature.
# endif
if ( ! respond_std & & ! respond_dp & & ! respond_qwoverq3 )
return false ;
if ( svs . gametype ! = GT_PROGS & & svs . gametype ! = GT_Q1QVM )
{ //if we're running q2 or q3, just ignore the whole DP thing. its irrelevent in those game modes.
respond_std | = true ;
# ifdef QWOVERQ3
respond_qwoverq3 = false ;
# endif
respond_dp = false ;
}
if ( respond_dp )
respond_std = false ;
2004-08-23 00:15:46 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
challenge = SV_NewChallenge ( ) ;
2004-08-23 00:15:46 +00:00
2017-05-18 10:24:09 +00:00
//different game modes require different types of responses
switch ( svs . gametype )
{
2005-03-07 08:58:26 +00:00
# ifdef Q3SERVER
2017-05-18 10:24:09 +00:00
case GT_QUAKE3 : //q3 servers
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
buf = va ( " challengeResponse %i " , challenge ) ;
2017-05-18 10:24:09 +00:00
break ;
2005-03-07 08:58:26 +00:00
# endif
# ifdef Q2SERVER
2017-05-18 10:24:09 +00:00
case GT_QUAKE2 :
2023-09-11 09:31:09 +00:00
buf = va ( " challenge %i p= " STRINGIFY ( PROTOCOL_VERSION_Q2EX ) , challenge ) ; //quake 2 servers give a different challenge response
2017-05-18 10:24:09 +00:00
break ;
2005-03-07 08:58:26 +00:00
# endif
2017-05-18 10:24:09 +00:00
default :
2016-07-12 00:40:13 +00:00
buf = va ( " %c%i " , S2C_CHALLENGE , challenge ) ; //quakeworld's response is a bit poo.
2017-05-18 10:24:09 +00:00
break ;
}
2004-08-23 00:15:46 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
over = buf + strlen ( buf ) + 1 ;
2004-11-20 00:51:57 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( svs . gametype = = GT_PROGS | | svs . gametype = = GT_Q1QVM )
{
unsigned int mask ;
//tell the client what fte extensions we support
2022-05-28 17:59:26 +00:00
mask = Net_PextMask ( PROTOCOL_VERSION_FTE1 , false ) & PEXT_SERVERADVERTISE ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( mask )
{
2019-05-10 09:31:21 +00:00
lng = LittleLong ( PROTOCOL_VERSION_FTE1 ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
2004-08-23 00:15:46 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
lng = LittleLong ( mask ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
}
//tell the client what fte extensions we support
2022-05-28 17:59:26 +00:00
mask = Net_PextMask ( PROTOCOL_VERSION_FTE2 , false ) & PEXT2_SERVERADVERTISE ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( mask )
{
lng = LittleLong ( PROTOCOL_VERSION_FTE2 ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
2009-11-04 21:16:50 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
lng = LittleLong ( mask ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
}
2019-05-10 09:31:21 +00:00
//tell the client what mvdsv/ezquake extensions we support
2021-08-04 21:16:57 +00:00
mask = Net_PextMask ( PROTOCOL_VERSION_EZQUAKE1 , false ) & EZPEXT1_SERVERADVERTISE ;
2019-05-10 09:31:21 +00:00
if ( mask )
{
lng = LittleLong ( PROTOCOL_VERSION_EZQUAKE1 ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
lng = LittleLong ( mask ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
}
//report the mtu
2017-03-04 19:36:06 +00:00
if ( * net_mtu . string )
mask = net_mtu . ival & ~ 7 ;
else
mask = 8192 ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( mask > 64 )
{
lng = LittleLong ( PROTOCOL_VERSION_FRAGMENT ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
2012-02-12 05:18:31 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
lng = LittleLong ( mask ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
}
2012-02-12 05:18:31 +00:00
2004-08-23 00:15:46 +00:00
# ifdef HUFFNETWORK
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
compressioncrc = Huff_PreferedCompressionCRC ( ) ;
if ( compressioncrc )
{
lng = LittleLong ( PROTOCOL_VERSION_HUFFMAN ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
2004-08-23 00:15:46 +00:00
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
lng = LittleLong ( compressioncrc ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
2004-11-20 00:51:57 +00:00
}
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
# endif
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
2023-02-20 08:35:56 +00:00
if ( net_enable_dtls . ival > 0 /* || !*net_enable_dtls.string*/ & & svs . sockets - > dtlsfuncs )
2017-05-18 10:24:09 +00:00
{
lng = LittleLong ( PROTOCOL_VERSION_DTLSUPGRADE ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
2016-07-12 00:40:13 +00:00
2023-02-20 08:35:56 +00:00
if ( net_enable_dtls . ival > = 3 )
lng = LittleLong ( 3 ) ; //required
else if ( net_enable_dtls . ival > = 2 )
lng = LittleLong ( 2 ) ; //encouraged
2017-05-18 10:24:09 +00:00
else
lng = LittleLong ( 1 ) ; //supported
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
}
# endif
2017-09-20 11:27:13 +00:00
if ( * sv_guidhash . string
# ifdef HAVE_DTLS
2018-03-24 04:02:09 +00:00
& & ( net_enable_dtls . ival < 3 | | net_from . prot = = NP_DTLS )
2017-09-20 11:27:13 +00:00
# endif
)
{
lng = LittleLong ( PROTOCOL_VERSION_VARLENGTH ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
lng = strlen ( sv_guidhash . string ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
lng = LittleLong ( PROTOCOL_INFO_GUID ) ;
memcpy ( over , & lng , sizeof ( lng ) ) ;
over + = sizeof ( lng ) ;
memcpy ( over , sv_guidhash . string , strlen ( sv_guidhash . string ) ) ;
over + = strlen ( sv_guidhash . string ) ;
}
2017-05-18 10:24:09 +00:00
}
if ( respond_dp )
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
{
2016-07-12 00:40:13 +00:00
char * dp ;
if ( sv_listen_qw . value )
dp = va ( " challenge FTE%i " , challenge ) ; //an FTE prefix will cause FTE clients to ignore the packet, to give preference to the qw challenge + protocols
else
2017-08-14 16:38:44 +00:00
dp = va ( " challenge %iDP " , challenge ) ; //we still need to add a postfix to prevent it from being interpreted as a Q2 server
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
Netchan_OutOfBand ( NS_SERVER , & net_from , strlen ( dp ) + 1 , dp ) ;
}
2017-05-18 10:24:09 +00:00
if ( respond_std )
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
Netchan_OutOfBand ( NS_SERVER , & net_from , over - buf , buf ) ;
2004-08-23 00:15:46 +00:00
2017-05-18 10:24:09 +00:00
# ifdef QWOVERQ3
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( svs . gametype = = GT_PROGS | | svs . gametype = = GT_Q1QVM )
{
2017-05-18 10:24:09 +00:00
if ( respond_qwoverq3 )
2008-11-09 22:29:28 +00:00
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
buf = va ( " challengeResponse %i " , challenge ) ;
Netchan_OutOfBand ( NS_SERVER , & net_from , strlen ( buf ) , buf ) ;
2008-11-09 22:29:28 +00:00
}
2004-08-23 00:15:46 +00:00
}
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
# endif
2017-05-18 10:24:09 +00:00
return true ;
2004-08-23 00:15:46 +00:00
}
2017-09-20 11:27:13 +00:00
# ifdef SVRANKING
2017-05-18 10:24:09 +00:00
static void VARGS SV_OutOfBandPrintf ( int q2 , netadr_t * adr , char * format , . . . )
2004-08-23 00:15:46 +00:00
{
va_list argptr ;
2008-02-05 02:44:01 +00:00
char string [ 8192 ] ;
2004-08-23 00:15:46 +00:00
va_start ( argptr , format ) ;
if ( q2 )
{
strcpy ( string , " print \n " ) ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string + 6 , sizeof ( string ) - 1 - 6 , format + 1 , argptr ) ;
2004-08-23 00:15:46 +00:00
}
else
{
string [ 0 ] = A2C_PRINT ;
string [ 1 ] = ' \n ' ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string + 2 , sizeof ( string ) - 1 - 2 , format , argptr ) ;
2004-08-23 00:15:46 +00:00
}
va_end ( argptr ) ;
Netchan_OutOfBand ( NS_SERVER , adr , strlen ( string ) , ( qbyte * ) string ) ;
}
2017-05-18 10:24:09 +00:00
static void VARGS SV_OutOfBandTPrintf ( int q2 , netadr_t * adr , int language , translation_t text , . . . )
2004-08-23 00:15:46 +00:00
{
va_list argptr ;
2008-02-05 02:44:01 +00:00
char string [ 8192 ] ;
2013-11-29 14:36:47 +00:00
const char * format = langtext ( text , language ) ;
2004-08-23 00:15:46 +00:00
va_start ( argptr , text ) ;
if ( q2 )
{
strcpy ( string , " print \n " ) ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string + 6 , sizeof ( string ) - 1 - 6 , format + 1 , argptr ) ;
2004-08-23 00:15:46 +00:00
}
else
{
string [ 0 ] = A2C_PRINT ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string + 1 , sizeof ( string ) - 1 - 1 , format , argptr ) ;
2004-08-23 00:15:46 +00:00
}
va_end ( argptr ) ;
Netchan_OutOfBand ( NS_SERVER , adr , strlen ( string ) , ( qbyte * ) string ) ;
}
2017-09-20 11:27:13 +00:00
# endif
2004-08-23 00:15:46 +00:00
2005-03-07 08:58:26 +00:00
qboolean SV_ChallengePasses ( int challenge )
{
int i ;
for ( i = 0 ; i < MAX_CHALLENGES ; i + + )
{ //one per ip.
2013-05-03 04:28:08 +00:00
if ( NET_CompareBaseAdr ( & net_from , & svs . challenges [ i ] . adr ) )
2005-03-07 08:58:26 +00:00
{
if ( challenge = = svs . challenges [ i ] . challenge )
return true ;
return false ;
}
}
return false ;
}
2017-09-20 11:27:13 +00:00
# ifdef NQPROT
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
//DP sends us a getchallenge followed by a CCREQ_CONNECT at about the same time.
//this means that DP clients tend to connect as generic NQ clients.
//and because DP _REQUIRES_ sv_bigcoords, they tend to end up being given fitz/rmq protocols
//thus we don't respond to the connect if sv_listen_dp is 1, and we had a recent getchallenge request. recent is 2 secs.
2023-08-19 02:14:09 +00:00
qboolean SV_ChallengeRecent ( void )
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
{
int curtime = realtime ; //yeah, evil. sue me. consitent with challenges.
int i ;
for ( i = 0 ; i < MAX_CHALLENGES ; i + + )
{ //one per ip.
if ( NET_CompareBaseAdr ( & net_from , & svs . challenges [ i ] . adr ) )
{
if ( svs . challenges [ i ] . time > curtime - 2 )
return true ;
}
}
return false ;
}
2017-09-20 11:27:13 +00:00
# endif
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
2019-07-02 04:12:20 +00:00
void VARGS SV_RejectMessage ( enum serverprotocols_e protocol , char * format , . . . )
2005-05-26 12:55:34 +00:00
{
va_list argptr ;
char string [ 8192 ] ;
int len ;
va_start ( argptr , format ) ;
switch ( protocol )
{
# ifdef NQPROT
case SCP_NETQUAKE :
2016-07-12 00:40:13 +00:00
case SCP_BJP3 :
2011-10-27 16:16:29 +00:00
case SCP_FITZ666 :
2005-05-26 12:55:34 +00:00
string [ 4 ] = CCREP_REJECT ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string + 5 , sizeof ( string ) - 1 - 5 , format , argptr ) ;
2005-05-26 12:55:34 +00:00
len = strlen ( string + 4 ) + 1 + 4 ;
* ( int * ) string = BigLong ( NETFLAG_CTL | len ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , len , string , & net_from ) ;
2005-05-26 12:55:34 +00:00
return ;
2005-05-27 05:41:07 +00:00
case SCP_DARKPLACES6 :
case SCP_DARKPLACES7 :
2005-05-26 12:55:34 +00:00
strcpy ( string , " reject " ) ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string + 7 , sizeof ( string ) - 1 - 7 , format , argptr ) ;
2005-05-26 12:55:34 +00:00
len = strlen ( string ) ;
break ;
# endif
case SCP_QUAKE2 :
2008-11-09 22:29:28 +00:00
case SCP_QUAKE3 :
2005-05-26 12:55:34 +00:00
default :
strcpy ( string , " print \n " ) ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string + 6 , sizeof ( string ) - 1 - 6 , format , argptr ) ;
2005-05-26 12:55:34 +00:00
len = strlen ( string ) ;
break ;
case SCP_QUAKEWORLD :
string [ 0 ] = A2C_PRINT ;
string [ 1 ] = ' \n ' ;
2006-03-06 01:41:09 +00:00
vsnprintf ( string + 2 , sizeof ( string ) - 1 - 2 , format , argptr ) ;
2005-05-26 12:55:34 +00:00
len = strlen ( string ) ;
break ;
}
va_end ( argptr ) ;
2013-05-03 04:28:08 +00:00
Netchan_OutOfBand ( NS_SERVER , & net_from , len , ( qbyte * ) string ) ;
2005-05-26 12:55:34 +00:00
}
2016-07-12 00:40:13 +00:00
void SV_AcceptMessage ( client_t * newcl )
2005-05-26 12:55:34 +00:00
{
char string [ 8192 ] ;
sizebuf_t sb ;
int len ;
2008-11-09 22:29:28 +00:00
# ifdef NQPROT
netadr_t localaddr ;
# endif
2005-05-26 12:55:34 +00:00
memset ( & sb , 0 , sizeof ( sb ) ) ;
sb . maxsize = sizeof ( string ) ;
sb . data = string ;
2023-09-11 09:31:09 +00:00
safeswitch ( newcl - > protocol )
2005-05-26 12:55:34 +00:00
{
# ifdef NQPROT
case SCP_NETQUAKE :
2016-07-12 00:40:13 +00:00
case SCP_BJP3 :
2011-10-27 16:16:29 +00:00
case SCP_FITZ666 :
2012-10-01 14:29:44 +00:00
// if (net_from.type != NA_LOOPBACK)
2011-10-27 16:16:29 +00:00
{
SZ_Clear ( & sb ) ;
MSG_WriteLong ( & sb , 0 ) ;
MSG_WriteByte ( & sb , CCREP_ACCEPT ) ;
2022-01-16 18:41:44 +00:00
if ( newcl - > qex )
2023-01-09 05:11:34 +00:00
; //skip any port info (as well as any proquake ident stuff).
2022-01-16 18:41:44 +00:00
else
2016-07-12 00:40:13 +00:00
{
2022-01-16 18:41:44 +00:00
NET_LocalAddressForRemote ( svs . sockets , & net_from , & localaddr , 0 ) ;
2023-01-09 05:11:34 +00:00
if ( net_from . prot = = NP_DTLS
# ifdef SUPPORT_ICE
| | net_from . type = = NA_ICE
# endif
)
MSG_WriteLong ( & sb , 0 ) ; //send a port of 0 if we expect the client to be sane enough and/or otherwise problematic.
else
MSG_WriteLong ( & sb , ShortSwap ( localaddr . port ) ) ;
2022-01-16 18:41:44 +00:00
if ( newcl - > proquake_angles_hack )
{
MSG_WriteByte ( & sb , MOD_PROQUAKE ) ;
MSG_WriteByte ( & sb , MOD_PROQUAKE_VERSION ) ;
MSG_WriteByte ( & sb , 0 /*flags*/ ) ;
}
2016-07-12 00:40:13 +00:00
}
2011-10-27 16:16:29 +00:00
* ( int * ) sb . data = BigLong ( NETFLAG_CTL | sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2011-10-27 16:16:29 +00:00
return ;
}
2005-05-27 05:41:07 +00:00
case SCP_DARKPLACES6 :
case SCP_DARKPLACES7 :
2005-05-26 12:55:34 +00:00
strcpy ( string , " accept " ) ;
len = strlen ( string ) ;
break ;
# endif
2008-11-09 22:29:28 +00:00
case SCP_QUAKE3 :
strcpy ( string , " connectResponse " ) ;
len = strlen ( string ) ;
break ;
2005-05-26 12:55:34 +00:00
case SCP_QUAKE2 :
2023-09-11 09:31:09 +00:00
case SCP_QUAKE2EX :
Q_snprintfz ( string , sizeof ( string ) , " client_connect%s%s \n " ,
( newcl - > protocol = = SCP_QUAKE2EX ) ? " " STRINGIFY ( PROTOCOL_VERSION_Q2EX ) : " " ,
2023-08-16 04:09:58 +00:00
( * fs_dlURL . string ? va ( " dlserver=%s " , fs_dlURL . string ) : " " ) //q2pro's dlserver hint
) ;
2005-05-26 12:55:34 +00:00
len = strlen ( string ) ;
break ;
2023-09-11 09:31:09 +00:00
safedefault :
case SCP_BAD :
2005-05-26 12:55:34 +00:00
case SCP_QUAKEWORLD :
string [ 0 ] = S2C_CONNECTION ;
string [ 1 ] = ' \n ' ;
string [ 2 ] = ' \0 ' ;
len = strlen ( string ) ;
break ;
}
2013-05-03 04:28:08 +00:00
Netchan_OutOfBand ( NS_SERVER , & net_from , len , ( qbyte * ) string ) ;
2005-05-26 12:55:34 +00:00
}
2023-01-09 05:11:17 +00:00
# if !defined(_DEBUG) || defined(_WIN32) || defined(FTE_TARGET_WEB)
static void SV_CheckRecentCrashes ( client_t * tellclient )
{
}
# else
2011-06-06 01:41:33 +00:00
# include <sys/stat.h>
static void SV_CheckRecentCrashes ( client_t * tellclient )
{
struct stat sb ;
if ( - 1 ! = stat ( " crash.log " , & sb ) )
{
2013-09-12 06:55:52 +00:00
if ( ( time ( NULL ) - sb . st_mtime ) > 2 * 24 * 60 * 60 )
2013-09-09 01:16:03 +00:00
return ; //after 2 days, we stop advertising that we once crashed.
2011-06-06 01:41:33 +00:00
SV_ClientPrintf ( tellclient , PRINT_HIGH , " \1 WARNING: crash.log exists, dated %s \n " , ctime ( & sb . st_mtime ) ) ;
}
}
# endif
2013-03-12 22:35:33 +00:00
void SV_ClientProtocolExtensionsChanged ( client_t * client )
{
int i ;
int maxpacketentities ;
extern cvar_t pr_maxedicts ;
2016-01-18 05:22:07 +00:00
client_t * seat ;
2013-03-12 22:35:33 +00:00
2020-10-06 03:17:28 +00:00
extern cvar_t sv_protocol ;
char * s = sv_protocol . string ;
while ( ( s = COM_Parse ( s ) ) )
{
if ( ! strcasecmp ( com_token , " fte2 " ) )
{ //fancy stuff
client - > fteprotocolextensions
| = PEXT_CSQC /*mods break without*/
| PEXT_CHUNKEDDOWNLOADS /*much faster downloads+redirects*/
;
client - > fteprotocolextensions2
| = PEXT2_PRYDONCURSOR /*mods might break without*/
// | PEXT2_VOICECHAT /*entirely optional*/
| PEXT2_SETANGLEDELTA /*mostly just nice to have*/
| PEXT2_REPLACEMENTDELTAS /*carries quite a bit of extra info*/
| PEXT2_MAXPLAYERS /*not supporting the extra players is bad*/
| PEXT2_PREDINFO /*fixes some repdelta issues (especially for nq)*/
| PEXT2_NEWSIZEENCODING /*more accurate sizes, for awkward mods*/
| PEXT2_INFOBLOBS /*allows mods to send infoblobs to csqc (for avatar images or whatever)*/
;
}
if ( ! strcasecmp ( com_token , " fte1 " ) )
{ //older stuff. most of this was replaced by replacementdeltas.
client - > fteprotocolextensions
| = PEXT_SETVIEW
| PEXT_SCALE
| PEXT_TRANS
| PEXT_ACCURATETIMINGS
| PEXT_SOUNDDBL
| PEXT_MODELDBL
| PEXT_ENTITYDBL
| PEXT_ENTITYDBL2
| PEXT_FLOATCOORDS
| PEXT_COLOURMOD
| PEXT_SPAWNSTATIC2
| PEXT_256PACKETENTITIES
| PEXT_SETATTACHMENT
| PEXT_CHUNKEDDOWNLOADS
| PEXT_CSQC
| PEXT_DPFLAGS
;
}
if ( ! strcasecmp ( com_token , " csqc " ) )
{ //JUST csqc.
client - > fteprotocolextensions
| = PEXT_CSQC
;
}
}
2022-05-28 17:59:26 +00:00
client - > fteprotocolextensions & = Net_PextMask ( PROTOCOL_VERSION_FTE1 , ISNQCLIENT ( client ) ) & PEXT_SERVERADVERTISE ;
client - > fteprotocolextensions2 & = Net_PextMask ( PROTOCOL_VERSION_FTE2 , ISNQCLIENT ( client ) ) & PEXT2_SERVERADVERTISE ;
2019-05-10 09:31:21 +00:00
client - > ezprotocolextensions1 & = Net_PextMask ( PROTOCOL_VERSION_EZQUAKE1 , ISNQCLIENT ( client ) ) & EZPEXT1_SERVERADVERTISE ;
2019-10-30 14:03:59 +00:00
client - > zquake_extensions & = SERVER_SUPPORTED_Z_EXTENSIONS ;
2015-01-21 18:18:37 +00:00
2021-08-04 21:16:57 +00:00
//older versions of fte didn't understand any interactions between ez's limited float support and replacement deltas. so only activate both when vrinputs is also supported.
if ( ( client - > ezprotocolextensions1 & EZPEXT1_FLOATENTCOORDS ) & & ( client - > fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS ) & & ! ( client - > fteprotocolextensions2 & PEXT2_VRINPUTS ) )
client - > ezprotocolextensions1 & = ~ EZPEXT1_FLOATENTCOORDS ;
2013-12-29 22:48:28 +00:00
//some gamecode can't cope with some extensions for some reasons... and I'm too lazy to fix the code to cope.
if ( svs . gametype = = GT_HALFLIFE )
2015-10-11 11:34:58 +00:00
client - > fteprotocolextensions2 & = ~ PEXT2_REPLACEMENTDELTAS ; //baseline issues
2013-12-29 22:48:28 +00:00
2019-10-30 14:03:59 +00:00
# ifdef HAVE_LEGACY
if ( ISQWCLIENT ( client ) )
{
//be prepared to recognise client versions, in order to block known-buggy extensions.
const char * s ;
int ver ;
extern cvar_t pext_ezquake_nochunks ;
extern cvar_t pext_ezquake_verfortrans ;
s = InfoBuf_ValueForKey ( & client - > userinfo , " *client " ) ;
if ( ! strncmp ( s , " ezQuake " , 7 ) | | ! strncmp ( s , " FortressOne " , 11 ) )
{
2023-01-09 05:13:22 +00:00
s = COM_Parse ( s ) ; //skip name-of-fork
2019-10-30 14:03:59 +00:00
COM_Parse ( s ) ; //tokenize the version
ver = atoi ( com_token ) ;
//this should actually have been resolved now, but for future use...
if ( ( client - > fteprotocolextensions & PEXT_CHUNKEDDOWNLOADS ) & & pext_ezquake_nochunks . ival )
{
client - > fteprotocolextensions & = ~ PEXT_CHUNKEDDOWNLOADS ;
SV_PrintToClient ( client , PRINT_HIGH , " ezQuake's implementation of chunked downloads is blocked on this server. \n " ) ;
}
//client fails to read the extra byte when PF_EXTRA_PFS is set, instead checking for the 18th bit in a 16-bit (signed) variable.
if ( ( client - > fteprotocolextensions & PEXT_TRANS ) & & ver < pext_ezquake_verfortrans . ival )
{
SV_PrintToClient ( client , PRINT_HIGH , " ezQuake's implementation of PEXT_TRANS is buggy. Disabling. \n " ) ;
client - > fteprotocolextensions & = ~ PEXT_TRANS ;
}
//in order to simultaneously support PF_SOLID+Z_EXT_PF_SOLID and PF_HULLSIZE_Z+Z_EXT_PF_ONGROUND, I had to redefine the protocol when both were enabled.
//ezquake does not understand the change.
if ( ( client - > zquake_extensions & ( Z_EXT_PF_ONGROUND | Z_EXT_PF_SOLID ) ) & & ver < pext_ezquake_verfortrans . ival )
{
if ( client - > fteprotocolextensions & PEXT_HULLSIZE )
SV_PrintToClient ( host_client , PRINT_HIGH , " ezQuake's implementation of PEXT_HULLSIZE conflicts with zquake extensions. \n " ) ;
if ( client - > fteprotocolextensions & PEXT_SCALE )
SV_PrintToClient ( host_client , PRINT_HIGH , " ezQuake's implementation of PEXT_SCALE conflicts with zquake extensions. \n " ) ;
if ( client - > fteprotocolextensions & PEXT_FATNESS )
SV_PrintToClient ( host_client , PRINT_HIGH , " ezQuake's implementation of PEXT_FATNESS conflicts with zquake extensions. \n " ) ;
if ( client - > fteprotocolextensions & PEXT_TRANS )
SV_PrintToClient ( host_client , PRINT_HIGH , " ezQuake's implementation of PEXT_TRANS conflicts with zquake extensions. \n " ) ;
client - > fteprotocolextensions & = ~ ( PEXT_HULLSIZE | PEXT_TRANS | PEXT_SCALE | PEXT_FATNESS ) ;
}
}
//its not that I'm singling out ezquake or anything, but it has too many people using outdated versions that its hard to ignore.
}
# endif
2013-12-29 22:48:28 +00:00
//
client - > maxmodels = 256 ;
2013-03-12 22:35:33 +00:00
if ( client - > fteprotocolextensions & PEXT_256PACKETENTITIES )
maxpacketentities = MAX_EXTENDED_PACKET_ENTITIES ;
else
maxpacketentities = MAX_STANDARD_PACKET_ENTITIES ; //true for qw,q2
2013-03-12 23:24:15 +00:00
if ( client - > fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS )
2013-03-12 22:35:33 +00:00
{
2013-06-23 02:17:02 +00:00
client - > max_net_clients = ISQWCLIENT ( client ) ? QWMAX_CLIENTS : NQMAX_CLIENTS ;
2017-07-04 05:07:51 +00:00
client - > max_net_staticents = ~ 0u ; //unlimited in both fte+qss.
2013-06-23 02:17:02 +00:00
2013-03-12 23:24:15 +00:00
//you need to reconnect for this to update, of course. so make sure its not *too* low...
client - > max_net_ents = bound ( 512 , pr_maxedicts . ival , MAX_EDICTS ) ;
2017-03-26 01:46:08 +00:00
client - > maxmodels = min ( 1u < < 14 , MAX_PRECACHE_MODELS ) ; //protocol limited to 14 bits.
2013-03-12 23:24:15 +00:00
}
else if ( ISQWCLIENT ( client ) ) //readd?
{
2013-06-23 02:17:02 +00:00
client - > max_net_clients = QWMAX_CLIENTS ;
2013-03-12 23:24:15 +00:00
client - > max_net_ents = 512 ;
if ( client - > fteprotocolextensions & PEXT_ENTITYDBL )
client - > max_net_ents + = 512 ;
if ( client - > fteprotocolextensions & PEXT_ENTITYDBL2 )
client - > max_net_ents + = 1024 ;
2017-07-04 05:07:51 +00:00
client - > max_net_staticents = 512 ; //the ezquake limit, too few people use vanilla to really care about that (it would be too unstable anyway). fodquake has no limit.
2013-03-12 22:35:33 +00:00
if ( client - > fteprotocolextensions & PEXT_MODELDBL )
2017-03-26 01:46:08 +00:00
client - > maxmodels = 512 ;
2013-03-12 22:35:33 +00:00
}
else if ( ISDPCLIENT ( client ) )
{
2013-06-23 02:17:02 +00:00
client - > max_net_clients = 255 ;
2013-03-12 22:35:33 +00:00
client - > max_net_ents = bound ( 512 , pr_maxedicts . ival , 32768 ) ;
2017-07-04 05:07:51 +00:00
client - > max_net_staticents = 1024 ; //its quite low, proportionally.
2016-07-12 00:40:13 +00:00
client - > maxmodels = MAX_PRECACHE_MODELS ; //protocol limit of 16 bits. 15 bits for late precaches. client limit of 1k
2013-03-12 22:35:33 +00:00
client - > datagram . maxsize = sizeof ( host_client - > datagram_buf ) ;
}
2016-07-12 00:40:13 +00:00
else if ( client - > protocol = = SCP_BJP3 | | client - > protocol = = SCP_FITZ666 )
2013-03-12 22:35:33 +00:00
{
2013-06-23 02:17:02 +00:00
client - > max_net_clients = NQMAX_CLIENTS ;
2014-03-30 08:55:06 +00:00
client - > max_net_ents = bound ( 512 , pr_maxedicts . ival , 32768 ) ; //fitzquake supports 65535, but our writeentity builtin works differently, which causes problems.
2017-07-04 05:07:51 +00:00
client - > max_net_staticents = 4096 ; //quakespasm has 4k, more than 3k starts to have issues with the msg_init buffer size.
2016-07-12 00:40:13 +00:00
client - > maxmodels = MAX_PRECACHE_MODELS ;
2016-09-01 14:31:24 +00:00
maxpacketentities = client - > max_net_ents ;
2013-03-12 22:35:33 +00:00
client - > datagram . maxsize = sizeof ( host_client - > datagram_buf ) ;
}
2022-01-16 18:41:44 +00:00
else if ( client - > qex )
2022-01-08 10:01:15 +00:00
{
client - > max_net_clients = NQMAX_CLIENTS ;
client - > datagram . maxsize = sizeof ( host_client - > datagram_buf ) ;
client - > max_net_ents = bound ( 512 , pr_maxedicts . ival , 32768 ) ;
client - > max_net_staticents = 4096 ;
}
2013-03-12 22:35:33 +00:00
else
{
2013-06-23 02:17:02 +00:00
client - > max_net_clients = NQMAX_CLIENTS ;
2013-03-12 22:35:33 +00:00
client - > datagram . maxsize = MAX_NQDATAGRAM ; //vanilla limit
2016-07-12 00:40:13 +00:00
if ( client - > proquake_angles_hack )
2015-04-27 06:19:33 +00:00
client - > max_net_ents = bound ( 512 , pr_maxedicts . ival , 8192 ) ;
else
client - > max_net_ents = bound ( 512 , pr_maxedicts . ival , 600 ) ;
2017-07-04 05:07:51 +00:00
client - > max_net_staticents = 128 ; //yeah, its low.
2013-03-12 22:35:33 +00:00
}
2013-06-23 02:17:02 +00:00
if ( client - > fteprotocolextensions2 & PEXT2_MAXPLAYERS )
client - > max_net_clients = MAX_CLIENTS ;
client - > max_net_clients = min ( client - > max_net_clients , MAX_CLIENTS ) ;
2016-07-12 00:40:13 +00:00
client - > pendingdeltabits = NULL ;
client - > pendingcsqcbits = NULL ;
2013-03-12 22:35:33 +00:00
//initialise the client's frames, based on that client's protocol
switch ( client - > protocol )
{
# ifdef Q3SERVER
case SCP_QUAKE3 :
if ( client - > frameunion . q3frames )
Z_Free ( client - > frameunion . q3frames ) ;
2022-03-08 05:31:34 +00:00
client - > frameunion . q3frames = NULL ; //Z_Malloc(Q3UPDATE_BACKUP*sizeof(*client->frameunion.q3frames));
2013-03-12 22:35:33 +00:00
break ;
# endif
# ifdef Q2SERVER
case SCP_QUAKE2 :
// build a new connection
// accept the new client
// this is the only place a client_t is ever initialized
client - > frameunion . q2frames = client - > frameunion . q2frames ; //don't touch these.
if ( client - > frameunion . q2frames )
Z_Free ( client - > frameunion . q2frames ) ;
client - > frameunion . q2frames = Z_Malloc ( sizeof ( q2client_frame_t ) * Q2UPDATE_BACKUP ) ;
break ;
# endif
default :
if ( client - > frameunion . frames )
Z_Free ( client - > frameunion . frames ) ;
2017-05-18 10:24:09 +00:00
if ( ( client - > fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS ) | | ISDPCLIENT ( client ) )
2013-03-12 22:35:33 +00:00
{
char * ptr ;
2015-11-18 07:37:39 +00:00
int maxents = maxpacketentities * 4 ; /*this is the max number of ents updated per frame. we can't track more, so...*/
if ( maxents > client - > max_net_ents )
maxents = client - > max_net_ents ;
2013-03-12 22:35:33 +00:00
ptr = Z_Malloc ( sizeof ( client_frame_t ) * UPDATE_BACKUP +
2016-07-12 00:40:13 +00:00
sizeof ( * client - > pendingdeltabits ) * client - > max_net_ents +
sizeof ( * client - > pendingcsqcbits ) * client - > max_net_ents +
sizeof ( * client - > frameunion . frames [ i ] . resend ) * maxents * UPDATE_BACKUP ) ;
2013-03-12 22:35:33 +00:00
client - > frameunion . frames = ( void * ) ptr ;
ptr + = sizeof ( * client - > frameunion . frames ) * UPDATE_BACKUP ;
2016-07-12 00:40:13 +00:00
client - > pendingdeltabits = ( void * ) ptr ;
ptr + = sizeof ( * client - > pendingdeltabits ) * client - > max_net_ents ;
client - > pendingcsqcbits = ( void * ) ptr ;
ptr + = sizeof ( * client - > pendingcsqcbits ) * client - > max_net_ents ;
2013-03-12 22:35:33 +00:00
for ( i = 0 ; i < UPDATE_BACKUP ; i + + )
{
2017-05-28 15:42:32 +00:00
client - > frameunion . frames [ i ] . maxresend = maxents ;
2016-07-12 00:40:13 +00:00
client - > frameunion . frames [ i ] . resend = ( void * ) ptr ;
ptr + = sizeof ( * client - > frameunion . frames [ i ] . resend ) * maxents ;
2015-10-27 15:20:15 +00:00
client - > frameunion . frames [ i ] . senttime = realtime ;
2013-03-12 22:35:33 +00:00
}
//make sure the reset is sent.
2022-05-28 17:59:26 +00:00
client - > pendingdeltabits [ 0 ] = UF_SV_REMOVE ;
2013-03-12 22:35:33 +00:00
}
2016-09-01 14:31:24 +00:00
else if ( ISNQCLIENT ( client ) )
{
client - > frameunion . frames = Z_Malloc ( ( sizeof ( client_frame_t ) ) * UPDATE_BACKUP ) ;
for ( i = 0 ; i < UPDATE_BACKUP ; i + + )
{
2017-05-28 15:42:32 +00:00
client - > frameunion . frames [ i ] . qwentities . max_entities = 0 ;
client - > frameunion . frames [ i ] . qwentities . entities = NULL ;
2016-09-01 14:31:24 +00:00
client - > frameunion . frames [ i ] . senttime = realtime ;
}
}
2013-03-12 22:35:33 +00:00
else
{
client - > frameunion . frames = Z_Malloc ( ( sizeof ( client_frame_t ) + sizeof ( entity_state_t ) * maxpacketentities ) * UPDATE_BACKUP ) ;
for ( i = 0 ; i < UPDATE_BACKUP ; i + + )
{
2017-05-28 15:42:32 +00:00
client - > frameunion . frames [ i ] . qwentities . max_entities = maxpacketentities ;
client - > frameunion . frames [ i ] . qwentities . entities = ( entity_state_t * ) ( client - > frameunion . frames + UPDATE_BACKUP ) + i * client - > frameunion . frames [ i ] . qwentities . max_entities ;
2015-10-27 15:20:15 +00:00
client - > frameunion . frames [ i ] . senttime = realtime ;
2013-03-12 22:35:33 +00:00
}
}
break ;
}
2016-01-18 05:22:07 +00:00
//make sure we have the right limits for splitscreen clients too (mostly for viewmodel safety checks)
for ( seat = client - > controlled ; seat ; seat = seat - > controlled )
{
seat - > max_net_clients = client - > max_net_clients ;
seat - > max_net_ents = client - > max_net_ents ;
seat - > maxmodels = client - > maxmodels ;
}
2016-10-22 07:06:51 +00:00
client - > lastsequence_acknowledged = - 2000000000 ;
2013-03-12 22:35:33 +00:00
}
2014-03-30 08:55:06 +00:00
2015-06-16 23:53:58 +00:00
//void NET_AdrToStringResolve (netadr_t *adr, void (*resolved)(void *ctx, void *data, size_t a, size_t b), void *ctx, size_t a, size_t b);
2019-07-16 02:59:12 +00:00
static void SV_UserDNSResolved ( void * ctx , void * data , size_t idx , size_t uid )
2015-06-16 23:53:58 +00:00
{
if ( idx < svs . allocated_client_slots )
{
2019-07-16 02:59:12 +00:00
client_t * cl = & svs . clients [ idx ] ;
if ( cl - > userid = = uid )
2015-06-16 23:53:58 +00:00
{
2019-07-16 02:59:12 +00:00
Z_Free ( cl - > reversedns ) ;
cl - > reversedns = data ;
SV_LogPlayer ( cl , va ( " dns %s " , cl - > reversedns ) ) ;
2015-06-16 23:53:58 +00:00
return ;
}
}
2019-07-16 02:59:12 +00:00
//client ran away before the dns completed
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
Con_DPrintf ( " stale dns lookup result: %s \n " , ( char * ) data ) ;
2015-06-16 23:53:58 +00:00
Z_Free ( data ) ;
2019-07-16 02:59:12 +00:00
}
2014-03-30 08:55:06 +00:00
2015-06-24 17:59:57 +00:00
client_t * SV_AddSplit ( client_t * controller , char * info , int id )
{
client_t * cl , * prev ;
2018-03-25 09:36:14 +00:00
int i , j ;
2015-06-24 17:59:57 +00:00
int curclients ;
2017-08-14 16:38:44 +00:00
qboolean loadgame ;
2020-09-08 05:11:09 +00:00
// const char *name;
char newname [ 80 ] ;
2018-03-25 09:36:14 +00:00
unsigned int clients = 0 , spectators = 0 ;
qboolean asspec ;
2015-06-24 17:59:57 +00:00
for ( curclients = 0 , prev = cl = controller ; cl ; cl = cl - > controlled )
{
prev = cl ;
curclients + + ;
}
if ( id & & curclients ! = id )
return NULL ; //this would be weird.
2018-03-25 09:36:14 +00:00
// if (curclients >= 16)
// return NULL; //protocol limit on stats.
2015-06-24 17:59:57 +00:00
if ( curclients > = MAX_SPLITS )
return NULL ;
//only allow splitscreen if its explicitly allowed. unless its the local client in which case its always allowed.
//wouldn't it be awesome if we could always allow it for spectators? the join command makes that awkward, though I suppose we could just drop the extras in that case.
if ( ! sv_allow_splitscreen . ival & & controller - > netchan . remote_address . type ! = NA_LOOPBACK )
2016-07-12 00:40:13 +00:00
return NULL ; //FIXME: allow spectators to do this anyway?
2015-06-24 17:59:57 +00:00
2017-08-14 16:38:44 +00:00
/* if (cl->state == cs_loadzombie)
{
if ( ! newcl )
{
if ( ( ( ! strcmp ( cl - > name , name ) | | ! * cl - > name ) & & ( ! * cl - > guid | | ! strcmp ( guid , cl - > guid ) ) ) | | sv . allocated_client_slots < = 1 ) //named, or first come first serve.
{
if ( cl - > istobeloaded )
Con_DPrintf ( " %s:Using loadzombie \n " , svs . name ) ;
else
Con_DPrintf ( " %s:Using parmzombie \n " , svs . name ) ;
newcl = cl ;
preserveparms = true ;
temp . istobeloaded = cl - > istobeloaded ;
memcpy ( temp . spawn_parms , cl - > spawn_parms , sizeof ( temp . spawn_parms ) ) ;
if ( cl - > userid )
temp . userid = cl - > userid ;
break ;
}
}
}
*/
2020-09-08 05:11:09 +00:00
SV_DeDupeName ( Info_ValueForKey ( info , " name " ) , cl , newname , sizeof ( newname ) ) ;
2015-06-24 17:59:57 +00:00
for ( i = 0 , cl = svs . clients ; i < sv . allocated_client_slots ; i + + , cl + + )
{
2017-08-14 16:38:44 +00:00
if ( cl - > state = = cs_loadzombie & & ! controller - > spectator )
{ //if this is a loadzombie with the same name as the new seat is trying to use then lets use that slot.
2020-09-08 05:11:09 +00:00
if ( ! strcmp ( cl - > name , newname ) )
2017-08-14 16:38:44 +00:00
break ;
2015-06-24 17:59:57 +00:00
}
}
if ( i = = sv . allocated_client_slots )
{
2017-08-14 16:38:44 +00:00
for ( i = 0 , cl = svs . clients ; i < sv . allocated_client_slots ; i + + , cl + + )
{
if ( cl - > state = = cs_free )
{
break ;
}
}
if ( i = = sv . allocated_client_slots )
{
SV_PrintToClient ( controller , PRINT_HIGH , " not enough free player slots \n " ) ;
return NULL ;
}
2015-06-24 17:59:57 +00:00
}
2017-08-14 16:38:44 +00:00
loadgame = ( cl - > state = = cs_loadzombie ) ;
2018-03-25 09:36:14 +00:00
if ( loadgame )
asspec = cl - > spectator ;
else
asspec = ! ! atoi ( Info_ValueForKey ( info , " spectator " ) ) ;
for ( j = 0 ; j < sv . allocated_client_slots ; j + + )
{
if ( svs . clients [ j ] . state = = cs_free )
continue ;
if ( svs . clients [ j ] . spectator & & svs . clients [ j ] . spectator ! = 2 )
spectators + + ;
else
clients + + ;
}
2019-07-03 17:53:08 +00:00
if ( controller - > netchan . remote_address . type ! = NA_LOOPBACK ) //ignore limits for the local client (they could just tweak the cvar instead, but that's a hassle)
2018-03-25 09:36:14 +00:00
if ( ( asspec ? spectators : clients ) > = ( asspec ? maxspectators . ival : maxclients . ival ) )
{
SV_PrintToClient ( controller , PRINT_HIGH , " Server full, cannot add new seat \n " ) ;
return NULL ;
}
2017-08-14 16:38:44 +00:00
2020-09-08 05:11:09 +00:00
{ //save off anything we might want to preserve
qboolean tobeloaded = cl - > istobeloaded ;
qboolean spawned = cl - > spawned ;
unsigned int userid = cl - > userid ;
float spawn_parms [ NUM_SPAWN_PARMS ] ;
memcpy ( spawn_parms , cl - > spawn_parms , sizeof ( spawn_parms ) ) ;
//now actually wipe the player slot
memset ( cl , 0 , sizeof ( * cl ) ) ;
//and restore preserved stuff, if its appropriate.
if ( loadgame )
{
cl - > istobeloaded = tobeloaded ;
cl - > spawned = spawned ;
cl - > userid = userid ;
memcpy ( cl - > spawn_parms , spawn_parms , sizeof ( cl - > spawn_parms ) ) ;
}
}
2018-03-25 09:36:14 +00:00
cl - > spectator = asspec ;
2015-06-24 17:59:57 +00:00
cl - > netchan . remote_address = controller - > netchan . remote_address ;
2016-07-12 00:40:13 +00:00
cl - > netchan . message . prim = controller - > netchan . message . prim ;
2021-08-14 04:04:15 +00:00
cl - > backbuf . prim = controller - > backbuf . prim ;
2021-08-04 21:16:57 +00:00
cl - > netchan . netprim = controller - > netchan . netprim ;
2015-06-24 17:59:57 +00:00
cl - > zquake_extensions = controller - > zquake_extensions ;
cl - > fteprotocolextensions = controller - > fteprotocolextensions ;
cl - > fteprotocolextensions2 = controller - > fteprotocolextensions2 ;
2021-08-04 21:16:57 +00:00
cl - > ezprotocolextensions1 = controller - > ezprotocolextensions1 ;
2015-06-24 17:59:57 +00:00
cl - > penalties = controller - > penalties ;
cl - > protocol = controller - > protocol ;
2016-01-18 05:22:07 +00:00
cl - > maxmodels = controller - > maxmodels ;
cl - > max_net_clients = controller - > max_net_clients ;
cl - > max_net_ents = controller - > max_net_ents ;
2015-06-24 17:59:57 +00:00
2016-07-12 00:40:13 +00:00
if ( * controller - > guid )
Q_snprintfz ( cl - > guid , sizeof ( cl - > guid ) , " %s:%i " , controller - > guid , curclients ) ;
else
Q_strncpyz ( cl - > guid , " " , sizeof ( cl - > guid ) ) ;
2015-06-24 17:59:57 +00:00
cl - > name = cl - > namebuf ;
cl - > team = cl - > teambuf ;
2021-07-17 15:10:10 +00:00
cl - > userinfo . ChangeCB = svs . info . ChangeCB ;
cl - > userinfo . ChangeCTX = & cl - > userinfo ;
2015-06-24 17:59:57 +00:00
2017-08-14 16:38:44 +00:00
if ( ! cl - > userid | | ! loadgame )
cl - > userid = + + nextuserid ;
2015-06-24 17:59:57 +00:00
cl - > playerclass = 0 ;
2016-07-12 00:40:13 +00:00
cl - > pendingdeltabits = NULL ;
cl - > pendingcsqcbits = NULL ;
2021-06-25 18:50:42 +00:00
cl - > seat = curclients ;
2016-01-18 05:22:07 +00:00
cl - > edict = NULL ;
# ifdef Q2SERVER
cl - > q2edict = NULL ;
# endif
switch ( svs . gametype )
{
# ifdef Q2SERVER
case GT_QUAKE2 :
cl - > q2edict = Q2EDICT_NUM ( i + 1 ) ;
2018-07-05 16:21:44 +00:00
if ( ! ge - > ClientConnect ( cl - > q2edict , info ) )
2016-01-18 05:22:07 +00:00
{
2018-07-05 16:21:44 +00:00
const char * reject = Info_ValueForKey ( info , " rejmsg " ) ;
2016-01-18 05:22:07 +00:00
if ( * reject )
SV_ClientPrintf ( controller , PRINT_HIGH , " Splitscreen Refused: %s \n " , reject ) ;
else
SV_ClientPrintf ( controller , PRINT_HIGH , " Splitscreen Refused \n " ) ;
Con_DPrintf ( " Game rejected a connection. \n " ) ;
return NULL ;
}
2018-07-05 16:21:44 +00:00
ge - > ClientUserinfoChanged ( cl - > q2edict , info ) ;
2016-01-18 05:22:07 +00:00
break ;
# endif
default :
2018-04-06 17:21:15 +00:00
cl - > edict = EDICT_NUM_PB ( svprogfuncs , i + 1 ) ;
2016-01-18 05:22:07 +00:00
break ;
}
2015-06-24 17:59:57 +00:00
prev - > controlled = cl ;
prev = cl ;
2015-07-01 23:15:25 +00:00
cl - > controller = controller ;
2015-06-24 17:59:57 +00:00
cl - > controlled = NULL ;
2018-07-05 16:21:44 +00:00
InfoBuf_FromString ( & cl - > userinfo , info , false ) ;
InfoBuf_RemoveKey ( & cl - > userinfo , " spectator " ) ;
2017-08-14 16:38:44 +00:00
//this is a hint rather than a game breaker should it fail.
2018-03-25 09:36:14 +00:00
if ( cl - > spectator )
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForStarKey ( & cl - > userinfo , " *spectator " , va ( " %i " , cl - > spectator ) ) ;
2018-03-25 09:36:14 +00:00
cl - > state = controller - > state ;
2023-01-26 07:07:53 +00:00
cl - > connection_started = realtime ;
2018-03-25 09:36:14 +00:00
// host_client = NULL;
// sv_player = NULL;
2015-06-24 17:59:57 +00:00
SV_ExtractFromUserinfo ( cl , true ) ;
2017-08-14 16:38:44 +00:00
if ( ! loadgame )
SV_GetNewSpawnParms ( cl ) ;
2015-06-24 17:59:57 +00:00
if ( cl - > state > = cs_connected )
{
cl - > sendinfo = true ;
2016-01-18 05:22:07 +00:00
if ( svprogfuncs )
SV_SetUpClientEdict ( cl , cl - > edict ) ;
2015-06-24 17:59:57 +00:00
}
if ( cl - > state > = cs_spawned )
SV_Begin_Core ( cl ) ;
return cl ;
}
2019-07-02 04:12:20 +00:00
void SV_DoDirectConnect ( svconnectinfo_t * fte_restrict info )
2004-08-23 00:15:46 +00:00
{
int i ;
client_t * cl , * newcl ;
client_t temp ;
edict_t * ent ;
# ifdef Q2SERVER
q2edict_t * q2ent ;
# endif
int edictnum ;
char * s ;
int clients , spectators ;
qboolean spectator ;
2019-07-02 04:12:20 +00:00
char basic [ 80 ] ;
2011-09-06 20:53:38 +00:00
qboolean redirect = false ;
2014-03-30 08:55:06 +00:00
qboolean preserveparms = false ;
2004-08-23 00:15:46 +00:00
2016-10-22 07:06:51 +00:00
# ifdef NQPROT
extern cvar_t sv_protocol_nq ;
# endif
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
char * name ;
2008-06-08 14:37:57 +00:00
char adrbuf [ MAX_ADR_SIZE ] ;
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
net_from = info - > adr ; //SV_AcceptMessage+SV_RejectMessage are lame.
// check for password or spectator_password
if ( svprogfuncs )
{
2023-09-11 09:31:09 +00:00
s = Info_ValueForKey ( info - > seat [ 0 ] . info , " spectator " ) ;
2019-07-02 04:12:20 +00:00
if ( s [ 0 ] & & strcmp ( s , " 0 " ) )
2014-05-10 13:42:13 +00:00
{
2019-07-02 04:12:20 +00:00
if ( spectator_password . string [ 0 ] & &
stricmp ( spectator_password . string , " none " ) & &
2023-02-20 08:35:56 +00:00
strcmp ( spectator_password . string , s ) & &
! NET_IsLoopBackAddress ( & info - > adr ) )
2019-07-02 04:12:20 +00:00
{ // failed
Con_TPrintf ( " %s:spectator password failed \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
SV_RejectMessage ( info - > protocol , " requires a spectator password \n \n " ) ;
return ;
}
2023-09-11 09:31:09 +00:00
Info_RemoveKey ( info - > seat [ 0 ] . info , " spectator " ) ; // remove key
Info_SetValueForStarKey ( info - > seat [ 0 ] . info , " *spectator " , " 1 " , sizeof ( info - > seat [ 0 ] . info ) ) ;
2019-07-02 04:12:20 +00:00
spectator = true ;
2014-05-10 13:42:13 +00:00
}
2019-07-02 04:12:20 +00:00
else
{
2023-08-08 18:28:53 +00:00
if ( ! password . string [ 0 ] | |
! stricmp ( password . string , " none " ) | |
NET_IsLoopBackAddress ( & info - > adr ) )
; //don't care, doesn't matter.
else if ( info - > protocol = = SCP_NETQUAKE )
{ //if its a proquake client then use numeric passwords, which take a bit of processing
char * e ;
2023-09-11 09:31:09 +00:00
int got = strtol ( Info_ValueForKey ( info - > seat [ 0 ] . info , " password " ) , NULL , 0 ) ;
2023-08-08 18:28:53 +00:00
int need = strtol ( password . string , & e , 0 ) ;
if ( * e )
need = CalcHashInt ( & hash_md4 , password . string , strlen ( password . string ) ) ;
if ( got ! = need )
{
Con_TPrintf ( " %s:password failed \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
SV_RejectMessage ( info - > protocol , " server requires a password \n \n " ) ;
return ;
}
}
else
2019-07-02 04:12:20 +00:00
{
2023-09-11 09:31:09 +00:00
s = Info_ValueForKey ( info - > seat [ 0 ] . info , " password " ) ;
2023-08-08 18:28:53 +00:00
if ( strcmp ( password . string , s ) )
{
Con_TPrintf ( " %s:password failed \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
SV_RejectMessage ( info - > protocol , " server requires a password \n \n " ) ;
return ;
}
2019-07-02 04:12:20 +00:00
}
spectator = false ;
2023-09-11 09:31:09 +00:00
Info_RemoveKey ( info - > seat [ 0 ] . info , " password " ) ; // remove passwd
Info_RemoveKey ( info - > seat [ 0 ] . info , " *spectator " ) ; // remove key
2019-07-02 04:12:20 +00:00
}
}
else
spectator = false ; //q2 does all of it's checks internally, and deals with spectator ship too
2008-11-09 22:29:28 +00:00
2019-07-02 04:12:20 +00:00
newcl = & temp ;
memset ( newcl , 0 , sizeof ( client_t ) ) ;
2008-11-09 22:29:28 +00:00
2019-07-02 04:12:20 +00:00
# ifdef NQPROT
if ( ! info - > supportedprotocols & & info - > protocol = = SCP_NETQUAKE )
{ //NQ protocols lack stuff like protocol extensions.
//its the wild west where nothing is known about the client and everything breaks.
//we defer the assumption to the sv_protocol_nq cvar (only for clients that don't report their known protocols)
if ( ! strcmp ( sv_protocol_nq . string , " fitz " ) )
info - > protocol = SCP_FITZ666 ;
else if ( ! strcmp ( sv_protocol_nq . string , " bjp " ) | | ! strcmp ( sv_protocol_nq . string , " bjp3 " ) )
info - > protocol = SCP_BJP3 ;
else if ( ! strcmp ( sv_protocol_nq . string , " dpp6 " ) | | ! strcmp ( sv_protocol_nq . string , " dp6 " ) )
info - > protocol = SCP_DARKPLACES6 ;
else if ( ! strcmp ( sv_protocol_nq . string , " dpp7 " ) | | ! strcmp ( sv_protocol_nq . string , " dp7 " ) )
info - > protocol = SCP_DARKPLACES7 ;
else if ( ! strcmp ( sv_protocol_nq . string , " id " ) | | ! strcmp ( sv_protocol_nq . string , " vanilla " ) )
info - > protocol = SCP_NETQUAKE ;
else switch ( sv_protocol_nq . ival )
2009-07-18 20:09:07 +00:00
{
2019-07-02 04:12:20 +00:00
case PROTOCOL_VERSION_RMQ :
case PROTOCOL_VERSION_FITZ :
info - > protocol = SCP_FITZ666 ;
break ;
case PROTOCOL_VERSION_BJP3 :
info - > protocol = SCP_BJP3 ;
break ;
case 15 :
info - > protocol = SCP_NETQUAKE ;
break ;
case PROTOCOL_VERSION_DP6 :
info - > protocol = SCP_DARKPLACES6 ;
break ;
case PROTOCOL_VERSION_DP7 :
info - > protocol = SCP_DARKPLACES7 ;
2008-11-09 22:29:28 +00:00
break ;
default :
2019-07-02 04:12:20 +00:00
Con_Printf ( " sv_protocol_nq set incorrectly \n " ) ;
case 0 :
//change nothing
break ;
2008-11-09 22:29:28 +00:00
}
}
2019-07-02 04:12:20 +00:00
newcl - > supportedprotocols = info - > supportedprotocols ;
newcl - > proquake_angles_hack = info - > proquakeanglehack ;
2022-01-16 18:41:44 +00:00
newcl - > qex = info - > isqex ;
2019-07-02 04:12:20 +00:00
# endif
2005-05-26 12:55:34 +00:00
2019-07-02 04:12:20 +00:00
newcl - > userid = + + nextuserid ;
newcl - > fteprotocolextensions = info - > ftepext1 ;
newcl - > fteprotocolextensions2 = info - > ftepext2 ;
2020-02-11 18:06:10 +00:00
newcl - > ezprotocolextensions1 = info - > ezpext1 ;
2019-07-02 04:12:20 +00:00
newcl - > protocol = info - > protocol ;
2020-02-11 18:06:10 +00:00
newcl - > pextknown = info - > ftepext1 | | info - > ftepext2 ;
2019-07-02 04:12:20 +00:00
Q_strncpyz ( newcl - > guid , info - > guid , sizeof ( newcl - > guid ) ) ;
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
// Con_TPrintf("%s:%s:connect\n", sv.name, NET_AdrToString (adrbuf, sizeof(adrbuf), &adr));
2016-07-12 00:40:13 +00:00
2019-07-02 04:12:20 +00:00
// if there is already a slot for this ip, drop it
for ( i = 0 , cl = svs . clients ; i < svs . allocated_client_slots ; i + + , cl + + )
{
if ( cl - > state = = cs_free | | cl - > state = = cs_loadzombie )
continue ;
if ( NET_CompareBaseAdr ( & info - > adr , & cl - > netchan . remote_address )
& & ( ( info - > protocol = = SCP_QUAKEWORLD & & cl - > netchan . qport = = info - > qport ) | | info - > adr . port = = cl - > netchan . remote_address . port ) )
2016-07-12 00:40:13 +00:00
{
2019-07-02 04:12:20 +00:00
if ( realtime - cl - > connection_started < sv_reconnectlimit . value )
2016-07-12 00:40:13 +00:00
{
2019-07-02 04:12:20 +00:00
Con_Printf ( " %s:reconnect rejected: too soon \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
return ;
}
2016-07-12 00:40:13 +00:00
2019-07-02 04:12:20 +00:00
if ( cl - > state = = cs_connected )
2016-07-12 00:40:13 +00:00
{
2019-07-02 04:12:20 +00:00
if ( cl - > protocol ! = info - > protocol )
2016-07-12 00:40:13 +00:00
{
2019-07-02 04:12:20 +00:00
Con_TPrintf ( " %s: diff prot connect \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
return ;
2016-07-12 00:40:13 +00:00
}
2019-07-02 04:12:20 +00:00
else
Con_TPrintf ( " %s:dup connect \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
2016-07-12 00:40:13 +00:00
}
2019-07-02 04:12:20 +00:00
/*else if (cl->state == cs_zombie)
{
Con_Printf ( " %s:reconnect \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & adr ) ) ;
} */
else
Con_TPrintf ( " %s:%s:reconnect \n " , svs . name , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
2005-06-14 04:52:10 +00:00
2019-07-02 04:12:20 +00:00
# if 1
//wait for timeout before the player can reuse that address:port combo. clients should pick a new port on reconnect if they want to connect instantly.
return ;
# else
//silently drop the old connection, without causing the old client to get a disconnect or anything stupid like that.
cl - > protocol = SCP_BAD ;
SV_DropClient ( cl ) ;
cl - > protocol = info - > protocol ;
break ;
# endif
}
}
2008-11-09 22:29:28 +00:00
2023-09-11 09:31:09 +00:00
name = Info_ValueForKey ( info - > seat [ 0 ] . info , " name " ) ;
2005-05-26 12:55:34 +00:00
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
/*
2019-07-02 04:12:20 +00:00
if ( sv . world . worldmodel & & info - > protocol = = SCP_QUAKEWORLD & & ! atoi ( Info_ValueForKey ( info - > userinfo , " iknow " ) ) )
2004-08-23 00:15:46 +00:00
{
2019-07-02 04:12:20 +00:00
if ( sv . world . worldmodel - > fromgame = = fg_halflife & & ! ( newcl - > fteprotocolextensions & PEXT_HLBSP ) )
2005-05-26 12:55:34 +00:00
{
2019-07-02 04:12:20 +00:00
if ( atof ( Info_ValueForKey ( info - > userinfo , " *FuhQuake " ) ) < 0.3 )
2005-05-26 12:55:34 +00:00
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " The server is using a halflife level and we don't think your client supports this \n use 'setinfo iknow 1' to ignore this check \n You can go to " ENGINEWEBSITE " to get a compatible client \n \n You may need to enable an option \n \n " ) ;
// Con_Printf("player %s was dropped due to incompatible client\n", name);
// return;
2005-05-26 12:55:34 +00:00
}
}
2019-07-02 04:12:20 +00:00
# ifdef PEXT_Q2BSP
else if ( sv . world . worldmodel - > fromgame = = fg_quake2 & & ! ( newcl - > fteprotocolextensions & PEXT_Q2BSP ) )
2005-05-26 12:55:34 +00:00
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " The server is using a q2bsp-format level and we don't think your client supports this \n use 'setinfo iknow 1' to ignore this check \n You can go to " ENGINEWEBSITE " to get a compatible client \n \n You may need to enable an option \n \n " ) ;
// Con_Printf("player %s was dropped due to incompatible client\n", name);
// return;
2005-05-26 12:55:34 +00:00
}
2016-07-12 00:40:13 +00:00
# endif
2019-07-02 04:12:20 +00:00
# ifdef PEXT_Q3BSP
else if ( sv . world . worldmodel - > fromgame = = fg_quake3 & & ! ( newcl - > fteprotocolextensions & PEXT_Q3BSP ) )
2005-05-26 12:55:34 +00:00
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " The server is using a q3bsp-format level and we don't think your client supports this \n use 'setinfo iknow 1' to ignore this check \n You can go to " ENGINEWEBSITE " to get a compatible client \n \n You may need to enable an option \n \n " ) ;
// Con_Printf("player %s was dropped due to incompatible client\n", name);
// return;
2005-05-26 12:55:34 +00:00
}
2019-07-02 04:12:20 +00:00
# endif
}
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
*/
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
SV_FixupName ( name , temp . namebuf , sizeof ( temp . namebuf ) ) ;
name = temp . namebuf ;
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
2019-07-02 04:12:20 +00:00
deleetstring ( basic , name ) ;
if ( ! * basic | | strstr ( basic , " console " ) )
name = " unnamed " ; //have fun dudes.
2005-05-26 12:55:34 +00:00
2019-07-02 04:12:20 +00:00
// count up the clients and spectators
clients = 0 ;
spectators = 0 ;
newcl = NULL ;
if ( ! sv . allocated_client_slots )
2017-05-18 10:24:09 +00:00
{
2019-07-02 04:12:20 +00:00
Con_Printf ( " Apparently, there are no client slots allocated. This shouldn't be happening \n " ) ;
return ;
2010-11-06 23:05:29 +00:00
}
2004-08-23 00:15:46 +00:00
for ( i = 0 , cl = svs . clients ; i < sv . allocated_client_slots ; i + + , cl + + )
{
if ( cl - > state = = cs_free )
continue ;
2018-03-25 09:36:14 +00:00
if ( cl - > spectator & & cl - > spectator ! = 2 )
2004-08-23 00:15:46 +00:00
spectators + + ;
else
clients + + ;
2014-03-30 08:55:06 +00:00
if ( cl - > state = = cs_loadzombie )
2021-05-27 11:34:15 +00:00
{ //only try if they actually match this one...
if ( ( ! strcmp ( cl - > name , name ) | | ! * cl - > name ) & & ( ! * cl - > guid | | ! strcmp ( info - > guid , cl - > guid ) ) )
2004-08-23 00:15:46 +00:00
{
2021-05-27 11:34:15 +00:00
newcl = cl ;
break ;
2004-08-23 00:15:46 +00:00
}
2021-05-27 11:34:15 +00:00
if ( ! newcl ) //just use any.
newcl = cl ;
2004-08-23 00:15:46 +00:00
}
}
2021-05-27 11:34:15 +00:00
if ( newcl )
{ //client is reprising a loaded slot.
2023-06-28 23:16:45 +00:00
if ( newcl - > istobeloaded )
2021-12-20 10:07:15 +00:00
{
SV_BroadcastTPrintf ( PRINT_HIGH , " %s reprises %s \n " , name , newcl - > name ) ;
2021-05-27 11:34:15 +00:00
Con_DPrintf ( " %s:Using loadzombie \n " , svs . name ) ;
2021-12-20 10:07:15 +00:00
}
2021-05-27 11:34:15 +00:00
else
Con_DPrintf ( " %s:Using parmzombie \n " , svs . name ) ;
preserveparms = true ;
temp . istobeloaded = newcl - > istobeloaded ;
temp . spawned = newcl - > spawned ;
memcpy ( temp . spawn_parms , newcl - > spawn_parms , sizeof ( temp . spawn_parms ) ) ;
if ( newcl - > userid )
temp . userid = newcl - > userid ;
}
else //client has no existing slot.
2004-08-23 00:15:46 +00:00
{
2020-04-19 05:11:19 +00:00
# ifdef SUBSERVERS
2014-03-30 08:55:06 +00:00
if ( SSV_IsSubServer ( ) )
{
2020-04-19 01:23:32 +00:00
if ( 1 )
{
sizebuf_t s ;
qbyte send [ 8192 ] ;
memset ( & s , 0 , sizeof ( s ) ) ;
s . data = send ;
s . maxsize = sizeof ( send ) ;
s . cursize = 2 ;
MSG_WriteByte ( & s , ccmd_foundplayer ) ;
MSG_WriteString ( & s , name ) ;
MSG_WriteString ( & s , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
MSG_WriteString ( & s , info - > guid ) ;
SSV_InstructMaster ( & s ) ;
return ;
}
else
{
SV_RejectMessage ( info - > protocol , " Direct connections are not permitted. \n " ) ;
Con_TPrintf ( " * rejected direct connection \n " ) ;
return ;
}
2014-03-30 08:55:06 +00:00
}
2020-04-19 05:11:19 +00:00
# endif
2014-03-30 08:55:06 +00:00
2010-11-06 23:05:29 +00:00
/*single player logic*/
2019-07-02 04:12:20 +00:00
if ( sv . allocated_client_slots = = 1 & & info - > adr . type = = NA_LOOPBACK )
2012-04-24 07:59:11 +00:00
if ( svs . clients [ 0 ] . state > = cs_connected )
2014-06-16 16:21:28 +00:00
{
Con_Printf ( " Kicking %s to make space for local client \n " , svs . clients [ 0 ] . name ) ;
2010-08-14 03:17:33 +00:00
SV_DropClient ( svs . clients ) ;
2014-06-16 16:21:28 +00:00
}
2010-08-14 03:17:33 +00:00
2004-08-23 00:15:46 +00:00
// if at server limits, refuse connection
2010-07-11 02:22:39 +00:00
if ( maxclients . ival > MAX_CLIENTS )
2004-08-23 00:15:46 +00:00
Cvar_SetValue ( & maxclients , MAX_CLIENTS ) ;
2010-07-11 02:22:39 +00:00
if ( maxspectators . ival > MAX_CLIENTS )
2004-08-23 00:15:46 +00:00
Cvar_SetValue ( & maxspectators , MAX_CLIENTS ) ;
2010-11-06 23:05:29 +00:00
// find a free client slot
2013-06-23 02:17:02 +00:00
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
cl = svs . clients + i ;
2004-08-23 00:15:46 +00:00
if ( cl - > state = = cs_free )
{
newcl = cl ;
break ;
}
}
2010-11-06 23:05:29 +00:00
2014-03-30 08:55:06 +00:00
/*only q1/h2 has a maxclients/maxspectators separation. q2 or q3 the gamecode enforces any such clienttype limits*/
2010-11-06 23:05:29 +00:00
if ( svprogfuncs )
{
if ( spectator & & spectators > = maxspectators . ival )
2011-09-06 20:53:38 +00:00
redirect = true ;
2010-11-06 23:05:29 +00:00
if ( ! spectator & & clients > = maxclients . ival )
2011-09-06 20:53:38 +00:00
redirect = true ;
}
else
{
if ( clients > = maxclients . ival )
redirect = true ;
}
if ( redirect )
{
extern cvar_t sv_fullredirect ;
if ( ! * sv_fullredirect . string )
2010-11-06 23:05:29 +00:00
newcl = NULL ;
}
2004-08-23 00:15:46 +00:00
if ( ! newcl )
{
2010-11-06 23:05:29 +00:00
if ( ! svprogfuncs )
2004-08-23 00:15:46 +00:00
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " \n server is full \n \n " ) ;
Con_TPrintf ( " %s:full connect \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
2010-11-06 23:05:29 +00:00
}
else
{
if ( spectator & & spectators > = maxspectators . ival )
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " \n server is full (%i of %i spectators) \n \n " , spectators , maxspectators . ival ) ;
Con_TPrintf ( " %s:full connect (spectators) \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
2010-11-06 23:05:29 +00:00
}
else if ( ! spectator & & clients > = maxclients . ival )
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " \n server is full (%i of %i players) \n \n " , clients , maxclients . ival ) ;
Con_TPrintf ( " %s:full connect (players) \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
}
2010-11-06 23:05:29 +00:00
else
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " \n server is full (%i of %i connections) \n \n " , clients + spectators , sv . allocated_client_slots ) ;
Con_TPrintf ( " %s:full connect \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & info - > adr ) ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
}
2004-08-23 00:15:46 +00:00
}
2019-07-02 04:12:20 +00:00
return ;
2004-08-23 00:15:46 +00:00
}
}
2009-03-03 01:52:30 +00:00
//set up the gamecode for this player, optionally drop them here
2004-08-23 00:15:46 +00:00
edictnum = ( newcl - svs . clients ) + 1 ;
2005-10-16 03:49:04 +00:00
switch ( svs . gametype )
2004-08-23 00:15:46 +00:00
{
2009-03-03 01:52:30 +00:00
# ifdef HLSERVER
//fallthrough
case GT_HALFLIFE :
{
char reject [ 128 ] ;
if ( ! SVHL_ClientConnect ( newcl , adr , reject ) )
{
SV_RejectMessage ( protocol , " %s " , reject ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
Con_TPrintf ( " %s:gamecode reject \n " , NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & adr ) ) ;
2009-03-03 01:52:30 +00:00
return NULL ;
}
2015-10-11 11:34:58 +00:00
temp . hledict = newcl - > hledict ;
2009-03-03 01:52:30 +00:00
}
break ;
# endif
2007-09-02 19:55:17 +00:00
# ifdef VM_Q1
case GT_Q1QVM :
2014-03-30 08:55:06 +00:00
# endif
# ifdef VM_LUA
case GT_LUA :
2007-09-02 19:55:17 +00:00
# endif
2005-10-16 03:49:04 +00:00
case GT_PROGS :
2019-07-02 04:12:20 +00:00
if ( info - > protocol = = SCP_QUAKE2 )
2014-05-10 13:42:13 +00:00
{
2020-02-26 00:37:52 +00:00
SV_RejectMessage ( info - > protocol , " This is a %s server. " , fs_manifest - > formalname ) ;
2014-05-10 13:42:13 +00:00
Con_DPrintf ( " * Rejected q2 client. \n " ) ;
2019-07-02 04:12:20 +00:00
return ;
2014-05-10 13:42:13 +00:00
}
2014-03-30 08:55:06 +00:00
if ( svprogfuncs )
2018-04-06 17:21:15 +00:00
ent = EDICT_NUM_UB ( svprogfuncs , edictnum ) ;
2014-03-30 08:55:06 +00:00
else
ent = NULL ;
2004-08-23 00:15:46 +00:00
# ifdef Q2SERVER
temp . q2edict = NULL ;
# endif
temp . edict = ent ;
2013-03-12 22:44:00 +00:00
{
2023-09-11 09:31:09 +00:00
const char * reject = SV_CheckRejectConnection ( & info - > adr , info - > seat [ 0 ] . info , info - > protocol , info - > ftepext1 , info - > ftepext2 , info - > ezpext1 , info - > guid ) ;
2013-03-12 22:44:00 +00:00
if ( reject )
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " %s " , reject ) ;
2014-05-10 13:42:13 +00:00
Con_DPrintf ( " * Game rejected a connection. \n " ) ;
2019-07-02 04:12:20 +00:00
return ;
2013-03-12 22:44:00 +00:00
}
}
2005-10-16 03:49:04 +00:00
break ;
2004-08-23 00:15:46 +00:00
# ifdef Q2SERVER
2005-10-16 03:49:04 +00:00
case GT_QUAKE2 :
2023-09-11 09:31:09 +00:00
if ( info - > protocol ! = SCP_QUAKE2 & & info - > protocol ! = SCP_QUAKE2EX )
2014-05-10 13:42:13 +00:00
{
2020-02-26 00:37:52 +00:00
SV_RejectMessage ( info - > protocol , " This is a %s server. " , fs_manifest - > formalname ) ;
2014-05-10 13:42:13 +00:00
Con_DPrintf ( " * Rejected non-q2 client. \n " ) ;
2019-07-02 04:12:20 +00:00
return ;
2014-05-10 13:42:13 +00:00
}
2005-07-03 15:16:20 +00:00
q2ent = Q2EDICT_NUM ( edictnum ) ;
2004-08-23 00:15:46 +00:00
temp . edict = NULL ;
temp . q2edict = q2ent ;
2023-09-11 09:31:09 +00:00
if ( ! ge - > ClientConnect ( q2ent , info - > seat [ 0 ] . info ) )
2014-05-10 13:42:13 +00:00
{
2023-09-11 09:31:09 +00:00
const char * reject = Info_ValueForKey ( info - > seat [ 0 ] . info , " rejmsg " ) ;
2014-05-10 13:42:13 +00:00
if ( * reject )
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " %s \n Connection Refused. " , reject ) ;
2014-05-10 13:42:13 +00:00
else
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info - > protocol , " Connection Refused. " ) ;
2014-05-10 13:42:13 +00:00
Con_DPrintf ( " Game rejected a connection. \n " ) ;
2019-07-02 04:12:20 +00:00
return ;
2014-05-10 13:42:13 +00:00
}
2004-08-23 00:15:46 +00:00
2023-09-11 09:31:09 +00:00
ge - > ClientUserinfoChanged ( q2ent , info - > seat [ 0 ] . info ) ;
2004-08-23 00:15:46 +00:00
2009-03-03 01:52:30 +00:00
break ;
# endif
default :
Sys_Error ( " Bad svs.gametype in SVC_DirectConnect " ) ;
break ;
}
2013-03-12 22:35:33 +00:00
if ( newcl - > frameunion . frames )
2009-03-03 01:52:30 +00:00
{
2013-03-12 22:35:33 +00:00
Con_Printf ( " Client frame info was set \n " ) ;
Z_Free ( newcl - > frameunion . frames ) ;
2005-10-16 03:49:04 +00:00
}
2005-07-03 15:16:20 +00:00
2013-06-23 02:17:02 +00:00
temp . name = newcl - > name ;
temp . team = newcl - > team ;
2019-07-02 04:12:20 +00:00
2018-07-05 16:21:44 +00:00
InfoSync_Clear ( & newcl - > infosync ) ;
2013-06-23 02:17:02 +00:00
* newcl = temp ;
2018-07-05 16:21:44 +00:00
newcl - > userinfo . ChangeCB = svs . info . ChangeCB ;
2021-05-27 11:34:15 +00:00
newcl - > userinfo . ChangeCTX = & newcl - > userinfo ;
2023-09-11 09:31:09 +00:00
InfoBuf_FromString ( & newcl - > userinfo , info - > seat [ 0 ] . info , false ) ;
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
newcl - > challenge = info - > challenge ;
2018-07-05 16:21:44 +00:00
newcl - > zquake_extensions = atoi ( InfoBuf_ValueForKey ( & newcl - > userinfo , " *z_ext " ) ) ;
2019-03-23 07:06:37 +00:00
InfoBuf_SetStarKey ( & newcl - > userinfo , " *z_ext " , " " ) ;
2018-07-05 16:21:44 +00:00
if ( * InfoBuf_ValueForKey ( & newcl - > userinfo , " *fuhquake " ) ) //fuhquake doesn't claim to support z_ext but does look at our z_ext serverinfo key.
2007-02-23 00:21:33 +00:00
{ //so switch on the bits that it should be sending.
newcl - > zquake_extensions | = Z_EXT_PM_TYPE | Z_EXT_PM_TYPE_NEW ;
}
2019-03-01 22:53:51 +00:00
newcl - > zquake_extensions & = SERVER_SUPPORTED_Z_EXTENSIONS ;
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
Netchan_Setup ( NS_SERVER , & newcl - > netchan , & info - > adr , info - > qport ) ;
2004-08-23 00:15:46 +00:00
2014-05-10 13:42:13 +00:00
# ifdef HUFFNETWORK
2019-07-02 04:12:20 +00:00
if ( info - > huffcrc )
newcl - > netchan . compresstable = Huff_CompressionCRC ( info - > huffcrc ) ;
2004-08-23 00:15:46 +00:00
else
2014-05-10 13:42:13 +00:00
# endif
newcl - > netchan . compresstable = NULL ;
2019-07-02 04:12:20 +00:00
newcl - > netchan . pext_fragmentation = info - > mtu ? true : false ;
2020-02-11 18:06:10 +00:00
newcl - > netchan . pext_stunaware = ! ! ( info - > ftepext2 & PEXT2_STUNAWARE ) ;
2019-05-23 15:11:32 +00:00
//this is the upper bound of the mtu, if its too high we'll get EMSGSIZE and we'll reduce it.
//however, if it drops below newcl->netchan.message.maxsize then we'll start to see undeliverable reliables, which means dropped clients.
newcl - > netchan . mtu = MAX_DATAGRAM ; //vanilla qw clients are assumed to have an mtu of this size.
2023-02-20 08:35:56 +00:00
if ( info - > mtu > = 300 ) //anything smaller is someone being intentionally malicious.
2019-05-10 09:31:21 +00:00
{ //if we support application fragmenting, then we can send massive reliables without too much issue
2019-07-02 04:12:20 +00:00
newcl - > netchan . mtu = info - > mtu ;
2012-04-24 07:59:11 +00:00
newcl - > netchan . message . maxsize = sizeof ( newcl - > netchan . message_buf ) ;
2023-02-20 08:35:56 +00:00
2023-03-15 17:57:31 +00:00
# ifdef HAVE_ICE
2023-02-20 08:35:56 +00:00
if ( info - > adr . type = = NA_ICE )
newcl - > netchan . mtu - = 48 + 12 ; //dtls+sctp overhead
2023-03-15 17:57:31 +00:00
else
# endif
if ( info - > adr . prot = = NP_DTLS | | info - > adr . prot = = NP_TLS )
2023-02-20 08:35:56 +00:00
newcl - > netchan . mtu - = 48 ; //dtls overhead
2012-04-24 07:59:11 +00:00
}
2019-07-02 04:12:20 +00:00
else
{ //otherwise we can't fragment the packets, and the only way to honour the mtu is to send less data. yay for more round-trips.
int mtu ;
2023-09-11 09:31:09 +00:00
mtu = atoi ( Info_ValueForKey ( info - > seat [ 0 ] . info , " mtu " ) ) ;
2019-05-23 15:11:32 +00:00
if ( mtu )
newcl - > netchan . mtu = mtu ; //locked mtu size, because not everyone has a working connection (we need icmp would-fragment responses for mtu detection)
else //if its not set then use some 'safe' fallback.
mtu = MAX_BACKBUFLEN ; //MAX_BACKBUFLEN of 1200 is < ipv6 required segment size so should always work for reliables.
//enforce some boundaries
mtu = bound ( 512 - 8 , mtu , sizeof ( newcl - > netchan . message_buf ) ) ;
newcl - > netchan . message . maxsize = mtu ;
}
Con_DLPrintf ( 2 , " MTU size: %i - %i \n " , newcl - > netchan . message . maxsize , newcl - > netchan . mtu ) ;
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
newcl - > protocol = info - > protocol ;
2005-07-16 00:53:08 +00:00
# ifdef NQPROT
2005-05-26 12:55:34 +00:00
newcl - > netchan . isnqprotocol = ISNQCLIENT ( newcl ) ;
2005-07-03 15:16:20 +00:00
# endif
2005-05-26 12:55:34 +00:00
2004-08-23 00:15:46 +00:00
newcl - > state = cs_connected ;
2023-01-26 07:07:53 +00:00
newcl - > connection_started = realtime ;
2004-08-23 00:15:46 +00:00
2008-11-09 22:29:28 +00:00
# ifdef Q3SERVER
newcl - > gamestatesequence = - 1 ;
# endif
2004-08-23 00:15:46 +00:00
newcl - > datagram . allowoverflow = true ;
newcl - > datagram . data = newcl - > datagram_buf ;
2019-07-02 04:12:20 +00:00
if ( info - > mtu > = 64 )
2013-03-12 22:13:26 +00:00
newcl - > datagram . maxsize = sizeof ( newcl - > datagram_buf ) ;
else
newcl - > datagram . maxsize = MAX_DATAGRAM ;
2004-08-23 00:15:46 +00:00
2023-09-11 09:31:09 +00:00
if ( newcl - > protocol = = SCP_QUAKE2EX )
{
newcl - > netchan . netprim =
newcl - > datagram . prim =
newcl - > backbuf . prim =
newcl - > netchan . message . prim = sv . q2multicast [ 1 ] . prim ;
}
else
{
newcl - > netchan . netprim =
newcl - > datagram . prim =
newcl - > backbuf . prim =
newcl - > netchan . message . prim = svs . netprim ;
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
2013-03-12 22:35:33 +00:00
SV_ClientProtocolExtensionsChanged ( newcl ) ;
2004-08-23 00:15:46 +00:00
// spectator mode can ONLY be set at join time
newcl - > spectator = spectator ;
2005-07-03 15:16:20 +00:00
2008-05-26 21:58:26 +00:00
newcl - > realip_ping = ( ( ( rand ( ) ^ ( rand ( ) < < 8 ) ^ * ( int * ) & realtime ) & 0xffffff ) < < 8 ) | ( newcl - svs . clients ) ;
2016-07-12 00:40:13 +00:00
# ifdef HEXEN2
2013-12-02 14:30:30 +00:00
if ( newcl - > istobeloaded & & newcl - > edict )
2012-01-24 04:24:14 +00:00
newcl - > playerclass = newcl - > edict - > xv - > playerclass ;
2016-07-12 00:40:13 +00:00
# endif
2012-01-24 04:24:14 +00:00
2019-07-02 04:12:20 +00:00
// parse some info from the info strings
SV_ExtractFromUserinfo ( newcl , true ) ;
// JACK: Init the floodprot stuff.
newcl - > floodprotmessage = 0.0 ;
newcl - > lastspoke = 0.0 ;
newcl - > lockedtill = 0 ;
# ifdef SVRANKING
//rankid is figured out in extract from user info
if ( ! newcl - > rankid ) //failed to get a userid
{
if ( rank_needlogin . value )
{
SV_RejectMessage ( info - > protocol , " Bad password/username \n This server requires logins. Please see the serverinfo for website and info on how to register. \n " ) ;
newcl - > state = cs_free ;
return ;
}
// SV_OutOfBandPrintf (isquake2client, adr, "\nWARNING: You have not got a place on the ranking system, probably because a user with the same name has already connected and your pwds differ.\n\n");
if ( ! preserveparms )
SV_GetNewSpawnParms ( newcl ) ;
}
else
{
rankstats_t rs ;
if ( ! Rank_GetPlayerStats ( newcl - > rankid , & rs ) )
{
SV_RejectMessage ( info - > protocol , " Rankings/Account system failed \n " ) ;
Con_TPrintf ( " banned player %s is trying to connect \n " , newcl - > name ) ;
newcl - > name [ 0 ] = 0 ;
InfoBuf_Clear ( & newcl - > userinfo , true ) ;
newcl - > state = cs_free ;
return ;
}
if ( rs . flags1 & RANK_MUTED )
{
SV_BroadcastTPrintf ( PRINT_MEDIUM , " %s is muted (still) \n " , newcl - > name ) ;
}
if ( rs . flags1 & RANK_CUFFED )
{
SV_BroadcastTPrintf ( PRINT_LOW , " %s is now cuffed permanently \n " , newcl - > name ) ;
}
if ( rs . flags1 & RANK_CRIPPLED )
{
SV_BroadcastTPrintf ( PRINT_HIGH , " %s is still crippled \n " , newcl - > name ) ;
}
if ( rs . timeonserver )
{
if ( preserveparms )
{ //do nothing.
}
else if ( sv_resetparms . value )
{
SV_GetNewSpawnParms ( newcl ) ;
}
else
{
extern cvar_t rank_parms_first , rank_parms_last ;
for ( i = 0 ; i < NUM_SPAWN_PARMS ; i + + )
{
if ( i < NUM_RANK_SPAWN_PARMS & & i > = rank_parms_first . ival & & i < = rank_parms_last . ival )
newcl - > spawn_parms [ i ] = rs . parm [ i ] ;
else
newcl - > spawn_parms [ i ] = 0 ;
}
}
if ( rs . timeonserver > 3 * 60 ) //woo. Ages.
s = va ( langtext ( " Welcome back %s. You have previously spent %i:%i hours connected \n " , newcl - > language ) , newcl - > name , ( int ) ( rs . timeonserver / ( 60 * 60 ) ) , ( int ) ( ( int ) ( rs . timeonserver / 60 ) % ( 60 ) ) ) ;
else //measure this guy in minuites.
s = va ( langtext ( " Welcome back %s. You have previously spent %i mins connected \n " , newcl - > language ) , newcl - > name , ( int ) ( rs . timeonserver / 60 ) ) ;
2023-08-19 02:14:09 +00:00
SV_OutOfBandPrintf ( ISQ2CLIENT ( info ) , & info - > adr , s ) ;
2019-07-02 04:12:20 +00:00
}
else if ( ! preserveparms )
{
SV_GetNewSpawnParms ( newcl ) ;
2023-08-19 02:14:09 +00:00
SV_OutOfBandTPrintf ( ISQ2CLIENT ( info ) , & info - > adr , newcl - > language , " Welcome %s. Your time on this server is being logged and ranked \n " , newcl - > name , ( int ) rs . timeonserver ) ;
2019-07-02 04:12:20 +00:00
}
//else loaded players already have their initial parms set
}
# else
// call the progs to get default spawn parms for the new client
if ( ! preserveparms )
{
SV_GetNewSpawnParms ( newcl ) ;
}
# endif
SV_AcceptMessage ( newcl ) ;
newcl - > state = cs_free ;
2021-12-20 10:07:15 +00:00
if ( redirect | | preserveparms )
2019-07-02 04:12:20 +00:00
{
}
2021-12-20 10:07:15 +00:00
else if ( ISNQCLIENT ( newcl ) )
2019-07-02 04:12:20 +00:00
{
2021-12-20 10:07:15 +00:00
//FIXME: we should delay this until we actually have a name, because right now they'll be called unnamed or unconnected or something
SV_BroadcastPrintf ( PRINT_LOW , " New client connected \n " ) ;
2019-07-02 04:12:20 +00:00
}
else if ( newcl - > spectator )
{
SV_BroadcastTPrintf ( PRINT_LOW , " spectator %s connected \n " , newcl - > name ) ;
// Con_Printf ("Spectator %s connected\n", newcl->name);
}
else
{
SV_BroadcastTPrintf ( PRINT_LOW , " client %s connected \n " , newcl - > name ) ;
// Con_DPrintf ("Client %s connected\n", newcl->name);
}
newcl - > state = cs_connected ;
newcl - > sendinfo = true ;
if ( ! redirect )
{
for ( i = 0 ; i < sizeof ( sv_motd ) / sizeof ( sv_motd [ 0 ] ) ; i + + )
{
if ( * sv_motd [ i ] . string )
SV_ClientPrintf ( newcl , PRINT_CHAT , " %s \n " , sv_motd [ i ] . string ) ;
}
}
SV_CheckRecentCrashes ( newcl ) ;
# ifdef VOICECHAT
SV_VoiceInitClient ( newcl ) ;
# endif
SV_EvaluatePenalties ( newcl ) ;
if ( newcl - > penalties & BAN_SPECONLY )
{
if ( spectators > = maxspectators . ival )
newcl - > drop = true ; //oops.
newcl - > spectator = spectator = true ;
InfoBuf_SetValueForStarKey ( & cl - > userinfo , " *spectator " , " 1 " ) ;
}
//only advertise PEXT_SPLITSCREEN when splitscreen is allowed, to avoid spam. this might mean people need to reconnect after its enabled. oh well.
if ( ! sv_allow_splitscreen . ival & & newcl - > netchan . remote_address . type ! = NA_LOOPBACK )
newcl - > fteprotocolextensions & = ~ PEXT_SPLITSCREEN ;
newcl - > controller = NULL ;
if ( ! redirect )
{
Sys_ServerActivity ( ) ;
PIN_ShowMessages ( newcl ) ;
}
# ifdef NQPROT
if ( ISNQCLIENT ( newcl ) )
{
newcl - > netchan . message . maxsize = sizeof ( newcl - > netchan . message_buf ) ;
host_client = newcl ;
SVNQ_New_f ( ) ;
}
# endif
newcl - > redirect = redirect ;
# ifdef SUBSERVERS
SSV_SavePlayerStats ( newcl , 0 ) ;
# endif
# ifdef IPLOG
if ( Q_strncasecmp ( newcl - > name , " unconnected " , 11 ) & & Q_strncasecmp ( newcl - > name , " connecting " , 10 ) )
IPLog_Add ( NET_AdrToString ( adrbuf , sizeof ( adrbuf ) , & newcl - > netchan . remote_address ) , newcl - > name ) ;
# endif
# ifdef NQPROT
newcl - > netchan . incoming_reliable_sequence = info - > expectedreliablesequence ;
# endif
2019-07-16 02:59:12 +00:00
if ( sv_use_dns . ival )
NET_AdrToStringResolve ( & info - > adr , SV_UserDNSResolved , NULL , newcl - svs . clients , newcl - > userid ) ;
2023-09-11 09:31:09 +00:00
for ( i = 1 ; i < info - > seats ; i + + )
SV_AddSplit ( newcl , info - > seat [ i ] . info , i ) ;
2019-07-02 04:12:20 +00:00
}
2023-09-11 09:31:09 +00:00
# ifdef Q2SERVER
void Q2EFixupInfo ( void * vctx , const char * key , const char * value )
{
int seat = - 1 ;
svconnectinfo_t * ctx = vctx ;
int l = strlen ( key ) ;
if ( l > 2 & & key [ l - 2 ] = = ' _ ' & & key [ l - 1 ] > = ' 0 ' & & key [ l - 1 ] < ' 0 ' + MAX_SPLITS )
{
seat = key [ l - 1 ] - ' 0 ' ;
( ( char * ) key ) [ l - 2 ] = 0 ; //strip out the annoying _0s
}
if ( seat < 0 )
{
for ( seat = 0 ; seat < ctx - > seats ; seat + + )
Info_SetValueForStarKey ( ctx - > seat [ seat ] . info , key , value , sizeof ( ctx - > seat [ seat ] . info ) ) ;
}
else
Info_SetValueForStarKey ( ctx - > seat [ seat ] . info , key , value , sizeof ( ctx - > seat [ seat ] . info ) ) ;
}
# endif
2019-07-02 04:12:20 +00:00
/*
= = = = = = = = = = = = = = = = = =
SVC_DirectConnect
A connection request that did not come from the master
= = = = = = = = = = = = = = = = = =
arguments must be tokenized first
Q3 : connect " \ key \v al "
DP : connect \ key \ val
QW : connect $ VER $ QPORT $ CHALLENGE " \ key \v al "
NQ : hacked to take the form of QW , but with protocol version 3.
UNSUPPORTED FTEQW / Splitscreen : connect2 $ VER $ QPORT $ CHALLENGE " \ key \v al " " \ key \v al "
extension flags follow it .
*/
void SVC_DirectConnect ( int expectedreliablesequence )
{
int version ;
# ifdef HUFFNETWORK
extern cvar_t net_compress ;
# endif
svconnectinfo_t info ;
# ifdef NQPROT
extern cvar_t sv_protocol_nq ;
info . proquakeanglehack = false ;
2022-01-08 10:01:15 +00:00
info . isqex = false ;
2019-07-02 04:12:20 +00:00
info . supportedprotocols = 0 ;
info . expectedreliablesequence = expectedreliablesequence ;
# endif
2019-09-04 07:59:40 +00:00
# ifdef HUFFNETWORK
info . huffcrc = 0 ;
# endif
2019-07-02 04:12:20 +00:00
info . mtu = 0 ;
info . ftepext1 = 0 ;
info . ftepext2 = 0 ;
2019-07-16 02:59:12 +00:00
info . ezpext1 = 0 ;
2019-07-02 04:12:20 +00:00
* info . guid = 0 ;
2023-09-11 09:31:09 +00:00
info . seats = 1 ;
2019-07-02 04:12:20 +00:00
if ( * Cmd_Argv ( 1 ) = = ' \\ ' )
{ //q3: connect "\key\val"
# ifndef QWOVERQ3
SV_RejectMessage ( SCP_QUAKE3 , " This is not a q3 server: %s \n " , version_string ( ) ) ;
Con_TPrintf ( " * rejected connect from q3 client \n " ) ;
return ;
# else
const char * s ;
//this is used by q3 (note, we already decrypted the huffman connection packet in a hack)
if ( ! sv_listen_q3 . ival )
{
SV_RejectMessage ( SCP_QUAKE3 , " Server is not accepting quake3 clients at this time: %s \n " , version_string ( ) ) ;
Con_TPrintf ( " * rejected connect from q3 client \n " ) ;
return NULL ;
}
numssclients = 1 ;
protocol = SCP_QUAKE3 ;
Q_strncpyz ( userinfo , Cmd_Argv ( 1 ) , sizeof ( userinfo ) - 1 ) ;
switch ( atoi ( Info_ValueForKey ( userinfo , " protocol " ) ) )
{
case 68 : //regular q3 1.32
break ;
// case 43: //q3 1.11 (most 'recent' demo)
// break;
default :
SV_RejectMessage ( SCP_BAD , " Server is %s. \n " , version_string ( ) ) ;
Con_TPrintf ( " * rejected connect from incompatable client \n " ) ;
return NULL ;
}
s = Info_ValueForKey ( userinfo , " challenge " ) ;
challenge = atoi ( s ) ;
s = Info_ValueForKey ( userinfo , " qport " ) ;
qport = atoi ( s ) ;
s = Info_ValueForKey ( userinfo , " name " ) ;
if ( ! * s )
Info_SetValueForKey ( userinfo , " name " , " UnnamedQ3 " , sizeof ( userinfo ) ) ;
# ifdef HUFFNETWORK
2019-09-04 07:59:40 +00:00
info . huffcrc = HUFFCRC_QUAKE3 ;
2019-07-02 04:12:20 +00:00
# endif
# endif
}
# ifdef NQPROT
else if ( * ( Cmd_Argv ( 0 ) + 7 ) = = ' \\ ' )
{ //DP has the userinfo attached directly to the end of the connect command
const char * s ;
if ( ! sv_listen_dp . value & & net_from . type ! = NA_LOOPBACK )
{
if ( ! sv_listen_nq . value )
SV_RejectMessage ( SCP_DARKPLACES6 , " Server is not accepting darkplaces clients at this time. \n " , version_string ( ) ) ;
Con_TPrintf ( " * rejected connect from dp client \n " ) ;
return ;
}
if ( progstype = = PROG_H2 )
{
if ( ! sv_listen_nq . value )
SV_RejectMessage ( SCP_DARKPLACES6 , " NQ protocols are not supported with hexen2 gamecode. \n " , version_string ( ) ) ;
Con_TPrintf ( " * rejected connect from dp client (because of hexen2) \n " ) ;
return ;
}
2023-09-11 09:31:09 +00:00
Q_strncpyz ( info . seat [ 0 ] . info , net_message . data + 11 , sizeof ( info . seat [ 0 ] . info ) - 1 ) ;
2019-07-02 04:12:20 +00:00
2023-09-11 09:31:09 +00:00
if ( strcmp ( Info_ValueForKey ( info . seat [ 0 ] . info , " protocol " ) , " darkplaces " STRINGIFY ( NQ_NETCHAN_VERSION ) ) )
2019-07-02 04:12:20 +00:00
{
SV_RejectMessage ( SCP_BAD , " Server is %s. \n " , version_string ( ) ) ;
Con_TPrintf ( " * rejected connect from incompatible client \n " ) ;
return ;
}
//it's a darkplaces client.
2023-09-11 09:31:09 +00:00
s = Info_ValueForKey ( info . seat [ 0 ] . info , " protocols " ) ;
2019-07-02 04:12:20 +00:00
while ( s & & * s )
{
static const struct
{
char * name ;
unsigned int bits ;
} dpnames [ ] =
{
{ " FITZ " , 1u < < SCP_FITZ666 } , //dp doesn't support this, but this is for potential compat if other engines use this handshake
{ " 666 " , 1u < < SCP_FITZ666 } , //dp doesn't support this, but this is for potential compat if other engines use this handshake
{ " RMQ " , 1u < < SCP_FITZ666 } , //fte doesn't distinguish, but assumes clients will support both
{ " 999 " , 1u < < SCP_FITZ666 } , //fte doesn't distinguish, but assumes clients will support both
{ " DP7 " , 1u < < SCP_DARKPLACES7 } ,
{ " DP6 " , 1u < < SCP_DARKPLACES6 } ,
{ " DP5 " , 0 } ,
{ " DP4 " , 0 } ,
{ " DP3 " , 0 } ,
{ " DP2 " , 0 } ,
{ " DP1 " , 0 } ,
{ " QW " , 0 } , //mixing protocols doesn't make sense, and would just confuse the client.
{ " QUAKEDP " , 1u < < SCP_NETQUAKE } ,
{ " QUAKE " , 1u < < SCP_NETQUAKE } ,
{ " NEHAHRAMOVIE " , 1u < < SCP_NETQUAKE } ,
{ " NEHAHRABJP " , 0 } ,
{ " NEHAHRABJP2 " , 0 } ,
{ " NEHAHRABJP3 " , 1u < < SCP_BJP3 } ,
{ " DP7DP6 " , ( 1u < < SCP_DARKPLACES7 ) | ( 1u < < SCP_DARKPLACES6 ) } , //stupid shitty buggy crappy client
2021-10-05 05:05:56 +00:00
{ " DP8DP7 " , /*(1u<<SCP_DARKPLACES8)|*/ ( 1u < < SCP_DARKPLACES7 ) } , //stupid shitty buggy crappy client
2019-07-02 04:12:20 +00:00
} ;
int p ;
s = COM_Parse ( s ) ;
for ( p = 0 ; p < countof ( dpnames ) ; p + + )
{
if ( ! Q_strcasecmp ( dpnames [ p ] . name , com_token ) )
{
info . supportedprotocols | = dpnames [ p ] . bits ;
break ;
}
}
if ( p = = countof ( dpnames ) )
Con_DPrintf ( " DP client reporting unknown protocol \" %s \" \n " , com_token ) ;
}
info . protocol = SCP_DARKPLACES7 ;
2004-08-23 00:15:46 +00:00
2023-09-11 09:31:09 +00:00
s = Info_ValueForKey ( info . seat [ 0 ] . info , " challenge " ) ;
2019-07-02 04:12:20 +00:00
if ( ! strncmp ( s , " FTE " , strlen ( " FTE " ) ) ) //cope with our mangling of the challenge.
info . challenge = atoi ( s + strlen ( " FTE " ) ) ;
else
info . challenge = atoi ( s ) ;
2004-08-23 00:15:46 +00:00
2023-09-11 09:31:09 +00:00
Info_RemoveKey ( info . seat [ 0 ] . info , " protocol " ) ;
Info_RemoveKey ( info . seat [ 0 ] . info , " protocols " ) ;
Info_RemoveKey ( info . seat [ 0 ] . info , " challenge " ) ;
2018-09-01 04:18:08 +00:00
2023-09-11 09:31:09 +00:00
s = Info_ValueForKey ( info . seat [ 0 ] . info , " name " ) ;
2019-07-02 04:12:20 +00:00
if ( ! * s )
2023-09-11 09:31:09 +00:00
Info_SetValueForKey ( info . seat [ 0 ] . info , " name " , " CONNECTING " , sizeof ( info . seat [ 0 ] . info ) ) ;
2018-09-01 04:18:08 +00:00
2019-07-02 04:12:20 +00:00
info . qport = 0 ;
info . proquakeanglehack = false ; //NOTE: DP clients fuck up here due to a DP client bug.
//DP clients will use 16bit angles if it has previously connected to a proquake-handshake server,
//and 8bit angles otherwise (or a non-proquake/non-dp/non-qw server more recently than the proquake one).
2004-08-23 00:15:46 +00:00
}
2023-09-11 09:31:09 +00:00
# endif
# ifdef Q2SERVER
else if ( atoi ( Cmd_Argv ( 1 ) ) = = PROTOCOL_VERSION_Q2EX )
{
int i , numseats ;
info . seats = numseats = atoi ( Cmd_Argv ( 2 ) ) ;
version = atoi ( Cmd_Argv ( 1 ) ) ;
info . protocol = SCP_QUAKE2EX ;
info . seats = bound ( 1 , numseats , countof ( info . seat ) ) ;
if ( info . seats < 1 | | info . seats > MAX_SPLITS )
{ //no splitscreen(yet)
SV_RejectMessage ( info . protocol , " bad number of seats \n " , PROTOCOL_VERSION_Q2 , version ) ;
Con_TPrintf ( " * rejected connect from version %i \n " , version ) ;
return ;
}
Q_strncpyz ( info . guid , Cmd_Argv ( 3 ) , sizeof ( info . guid ) ) ;
//Socials - Cmd_Argv(3 ... 3+numseats-1); fuck that spyware
for ( i = 0 ; i < info . seats ; i + + )
* info . seat [ i ] . info = 0 ;
Info_Enumerate ( va ( " \\ %s " , Cmd_Argv ( 3 + numseats ) ) , & info , Q2EFixupInfo ) ;
//hide a challenge in there, in case we're not using the lobby stuff.
info . challenge = atoi ( Info_ValueForKey ( info . seat [ 0 ] . info , " challenge " ) ) ;
info . qport = atoi ( Info_ValueForKey ( info . seat [ 0 ] . info , " qport " ) ) ;
for ( i = 0 ; i < info . seats ; i + + )
{
Info_RemoveKey ( info . seat [ i ] . info , " challenge " ) ;
Info_RemoveKey ( info . seat [ i ] . info , " qport " ) ;
}
}
2019-07-02 04:12:20 +00:00
# endif
2004-08-23 00:15:46 +00:00
else
{
2019-07-02 04:12:20 +00:00
//fte: connectN is no longer supported (multiple userinfos packed into a single packet was a bad idea when userinfos can be so large
2019-07-16 02:59:12 +00:00
/*if (atoi(Cmd_Argv(0)+7))
2018-09-01 04:18:08 +00:00
{
2019-07-02 04:12:20 +00:00
int numssclients = atoi ( Cmd_Argv ( 0 ) + 7 ) ;
if ( numssclients ! = 1 )
{
SV_RejectMessage ( SCP_BAD , " Server is %s. \n " , version_string ( ) ) ;
Con_TPrintf ( " * rejected connect from old client \n " ) ;
return ;
}
2019-07-16 02:59:12 +00:00
} */
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
version = atoi ( Cmd_Argv ( 1 ) ) ;
2023-08-19 02:14:09 +00:00
if ( version > = PROTOCOL_VERSION_Q2_MIN & & version < = PROTOCOL_VERSION_Q2 )
2019-07-02 04:12:20 +00:00
info . protocol = SCP_QUAKE2 ;
# ifdef NQPROT
2022-01-08 10:01:15 +00:00
else if ( version = = NQ_NETCHAN_VERSION )
2018-09-01 04:18:08 +00:00
{
2019-07-02 04:12:20 +00:00
info . protocol = SCP_NETQUAKE ; //because we can
switch ( atoi ( Info_ValueForKey ( Cmd_Argv ( 4 ) , " mod " ) ) )
2004-08-23 00:15:46 +00:00
{
2019-07-02 04:12:20 +00:00
case 1 :
info . proquakeanglehack = true ;
break ;
case PROTOCOL_VERSION_FITZ :
case PROTOCOL_VERSION_RMQ :
info . protocol = SCP_FITZ666 ;
break ;
case PROTOCOL_VERSION_BJP3 :
info . protocol = SCP_BJP3 ;
info . proquakeanglehack = true ;
break ;
2018-09-01 04:18:08 +00:00
}
}
2022-01-08 10:01:15 +00:00
else if ( version = = NQ_NETCHAN_VERSION_QEX )
{ //rerelease...
2022-01-16 18:41:44 +00:00
info . protocol = SCP_FITZ666 ; //NETQUAKE;
2022-01-08 10:01:15 +00:00
info . isqex = true ;
}
2019-07-02 04:12:20 +00:00
# endif
else if ( version = = PROTOCOL_VERSION_QW )
info . protocol = SCP_QUAKEWORLD ;
else
2018-09-01 04:18:08 +00:00
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( SCP_BAD , " Server is protocol version %i, received %i \n " , PROTOCOL_VERSION_QW , version ) ;
Con_TPrintf ( " * rejected connect from version %i \n " , version ) ;
return ;
2004-08-23 00:15:46 +00:00
}
2019-07-02 04:12:20 +00:00
info . qport = atoi ( Cmd_Argv ( 2 ) ) ;
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
info . challenge = atoi ( Cmd_Argv ( 3 ) ) ;
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
// note an extra qbyte is needed to replace spectator key
2023-09-11 09:31:09 +00:00
Q_strncpyz ( info . seat [ 0 ] . info , Cmd_Argv ( 4 ) , sizeof ( info . seat [ 0 ] . info ) - 1 ) ;
2022-01-16 18:41:34 +00:00
if ( info . protocol > = SCP_NETQUAKE )
{
2023-09-11 09:31:09 +00:00
Info_RemoveKey ( info . seat [ 0 ] . info , " mod " ) ; //its served its purpose.
Info_RemoveKey ( info . seat [ 0 ] . info , " modver " ) ; //its served its purpose.
Info_RemoveKey ( info . seat [ 0 ] . info , " flags " ) ; //its served its purpose.
2022-01-16 18:41:34 +00:00
}
2004-08-23 00:15:46 +00:00
}
2019-07-02 04:12:20 +00:00
# ifdef HAVE_DTLS
2022-08-07 23:49:33 +00:00
if ( net_enable_dtls . ival > 2 & & ( net_from . prot = = NP_DGRAM | | net_from . prot = = NP_STREAM | | net_from . prot = = NP_WS ) & & net_from . type ! = NA_LOOPBACK & & ! NET_IsEncrypted ( & net_from ) )
2004-08-23 00:15:46 +00:00
{
2019-07-02 04:12:20 +00:00
SV_RejectMessage ( info . protocol , " This server requires the use of DTLS/TLS/WSS. \n " ) ;
return ;
2004-08-23 00:15:46 +00:00
}
2019-07-02 04:12:20 +00:00
# endif
2004-08-23 00:15:46 +00:00
{
2019-07-02 04:12:20 +00:00
char * banreason = SV_BannedReason ( & net_from ) ;
if ( banreason )
2011-09-06 20:53:38 +00:00
{
2019-07-02 04:12:20 +00:00
if ( * banreason )
SV_RejectMessage ( info . protocol , " You were banned. \n Reason: %s \n " , banreason ) ;
else
SV_RejectMessage ( info . protocol , " You were banned. \n " ) ;
return ;
2011-09-06 20:53:38 +00:00
}
2004-08-23 00:15:46 +00:00
}
2019-07-02 04:12:20 +00:00
if ( info . protocol = = SCP_QUAKEWORLD ) //readd?
2014-06-30 21:57:35 +00:00
{
2019-07-02 04:12:20 +00:00
if ( ! sv_listen_qw . value & & net_from . type ! = NA_LOOPBACK )
{
SV_RejectMessage ( info . protocol , " QuakeWorld protocols are not permitted on this server. \n " ) ;
Con_TPrintf ( " * rejected connect from quakeworld \n " ) ;
return ;
}
2014-06-30 21:57:35 +00:00
}
2023-08-19 02:14:09 +00:00
// see if the challenge is valid.
2019-07-02 04:12:20 +00:00
if ( net_from . type = = NA_LOOPBACK ) //normal rules don't apply
;
2023-08-19 02:14:09 +00:00
else if ( net_from . prot ! = NP_DGRAM )
; //challenge checks are irrelevant when we've alread passed a challenge in a lower network layer.
2015-07-06 14:47:46 +00:00
else
{
2019-07-02 04:12:20 +00:00
if ( ! SV_ChallengePasses ( info . challenge ) )
{
if ( sv_listen_dp . ival & & ! info . challenge & & info . protocol = = SCP_QUAKEWORLD )
{
//dp replies with 'challenge'. which vanilla quakeworld interprets as: c<CHALLENGEID><ignored junk 'hallenge'>
//so just silence that error.
return ;
}
SV_RejectMessage ( info . protocol , " Bad challenge. \n " ) ;
return ;
}
2015-07-06 14:47:46 +00:00
}
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
if ( sv_banproxies . ival )
2011-09-06 20:53:38 +00:00
{
2019-07-02 04:12:20 +00:00
//FIXME: allow them to spectate but not join
2023-09-11 09:31:09 +00:00
if ( * Info_ValueForKey ( info . seat [ 0 ] . info , " *qwfwd " ) )
2019-07-02 04:12:20 +00:00
{
SV_RejectMessage ( info . protocol , " Proxies are not permitted on this server. \n " ) ;
Con_TPrintf ( " * rejected connect from qwfwd proxy \n " ) ;
return ;
}
2023-09-11 09:31:09 +00:00
if ( * Info_ValueForKey ( info . seat [ 0 ] . info , " Qizmo " ) )
2019-07-02 04:12:20 +00:00
{
SV_RejectMessage ( info . protocol , " Proxies are not permitted on this server. \n " ) ;
Con_TPrintf ( " * rejected connect from qizmo proxy \n " ) ;
return ;
}
2023-09-11 09:31:09 +00:00
if ( * Info_ValueForKey ( info . seat [ 0 ] . info , " *qtv " ) )
2019-07-02 04:12:20 +00:00
{
SV_RejectMessage ( info . protocol , " Proxies are not permitted on this server. \n " ) ;
Con_TPrintf ( " * rejected connect from qtv proxy (udp) \n " ) ;
return ;
}
2011-09-06 20:53:38 +00:00
}
2005-12-15 19:15:39 +00:00
2019-07-02 04:12:20 +00:00
while ( ! msg_badread )
2004-08-23 00:15:46 +00:00
{
2019-07-02 04:12:20 +00:00
Cmd_TokenizeString ( MSG_ReadStringLine ( ) , false , false ) ;
switch ( Q_atoi ( Cmd_Argv ( 0 ) ) )
{
case PROTOCOL_VERSION_FTE1 :
if ( info . protocol = = SCP_QUAKEWORLD | | info . protocol = = SCP_QUAKE2 )
{
info . ftepext1 = Q_atoi ( Cmd_Argv ( 1 ) ) ;
Con_DPrintf ( " Client supports 0x%x fte extensions \n " , info . ftepext1 ) ;
}
break ;
case PROTOCOL_VERSION_FTE2 :
if ( info . protocol = = SCP_QUAKEWORLD )
{
info . ftepext2 = Q_atoi ( Cmd_Argv ( 1 ) ) ;
Con_DPrintf ( " Client supports 0x%x fte2 extensions \n " , info . ftepext2 ) ;
}
break ;
2019-07-16 02:59:12 +00:00
case PROTOCOL_VERSION_EZQUAKE1 :
if ( info . protocol = = SCP_QUAKEWORLD )
{
info . ezpext1 = Q_atoi ( Cmd_Argv ( 1 ) ) ;
Con_DPrintf ( " Client supports 0x%x ez1 extensions \n " , info . ezpext1 ) ;
}
break ;
2019-07-02 04:12:20 +00:00
case PROTOCOL_VERSION_HUFFMAN :
# ifdef HUFFNETWORK
info . huffcrc = Q_atoi ( Cmd_Argv ( 1 ) ) ;
Con_DPrintf ( " Client supports huffman compression. crc 0x%x \n " , info . huffcrc ) ;
if ( ! net_compress . ival | | ! Huff_CompressionCRC ( info . huffcrc ) )
{
SV_RejectMessage ( info . protocol , " Compression should not have been enabled. \n " ) ; //buggy/exploiting client. can also happen from timing when changing the setting, but whatever
Con_TPrintf ( " * rejected - bad compression state \n " ) ;
return ;
}
2015-09-01 04:45:15 +00:00
# endif
2019-07-02 04:12:20 +00:00
break ;
case PROTOCOL_VERSION_FRAGMENT :
info . mtu = Q_atoi ( Cmd_Argv ( 1 ) ) & ~ 7 ;
if ( info . mtu < 64 )
info . mtu = 0 ;
Con_DPrintf ( " Client supports fragmentation. mtu %i. \n " , info . mtu ) ;
break ;
case PROTOCOL_INFO_GUID :
Q_strncpyz ( info . guid , Cmd_Argv ( 1 ) , sizeof ( info . guid ) ) ;
Con_DPrintf ( " GUID %s \n " , Cmd_Argv ( 1 ) ) ;
break ;
}
}
msg_badread = false ;
2004-08-23 00:15:46 +00:00
2019-07-02 04:12:20 +00:00
info . adr = net_from ;
if ( MSV_ClusterLogin ( & info ) )
return ;
2017-01-24 10:27:39 +00:00
2019-07-02 04:12:20 +00:00
SV_DoDirectConnect ( & info ) ;
2005-05-26 12:55:34 +00:00
}
2004-08-23 00:15:46 +00:00
2018-08-21 18:52:25 +00:00
static int dehex ( int i )
{
if ( i > = ' 0 ' & & i < = ' 9 ' )
return ( i - ' 0 ' ) ;
else if ( i > = ' A ' & & i < = ' F ' )
return ( i - ' A ' + 10 ) ;
else
return ( i - ' a ' + 10 ) ;
}
2018-12-04 08:57:29 +00:00
static qboolean Rcon_Validate ( void )
2004-08-23 00:15:46 +00:00
{
2019-03-23 07:06:37 +00:00
/*
The rcon protocol sucks .
1 ) vanilla sent it plain text
2 ) there ' s no challenge , so there ' s no way to block spoofed requests
3 ) the hashed version of the protocol still has no challenge
*/
2018-08-21 18:52:25 +00:00
const char * realpass = rcon_password . string ;
const char * pass = Cmd_Argv ( 1 ) ;
if ( ! strlen ( realpass ) )
2018-12-04 08:57:29 +00:00
return false ;
2004-08-23 00:15:46 +00:00
2018-12-04 08:57:29 +00:00
if ( ! sv_crypt_rcon . ival | | ! * sv_crypt_rcon . string )
2018-08-21 18:52:25 +00:00
{ //vanilla-compatible
if ( ! strcmp ( pass , realpass ) )
2018-12-04 08:57:29 +00:00
return true ;
2018-08-21 18:52:25 +00:00
}
if ( sv_crypt_rcon . ival | | ! * sv_crypt_rcon . string )
{ //ezquake-compatible
//the password arg is "[SHA1Digest][unixtime-in-hex]" where the digest is "[arg0] password[unixtime] arg0 arg1 argn "
time_t clienttime = 0 ;
time_t servertime = 0 ;
intptr_t timediff ;
qbyte b ;
2020-03-25 21:29:30 +00:00
const hashfunc_t * hashfunc = & hash_sha1 ;
void * hashctx = alloca ( hashfunc - > contextsize ) ;
2018-08-21 18:52:25 +00:00
const size_t digestsize = 20 ;
size_t i , k ;
2018-09-01 04:18:08 +00:00
unsigned char digest [ 512 ] ;
2018-08-21 18:52:25 +00:00
const unsigned char * * tokens = alloca ( sizeof ( * tokens ) * ( Cmd_Argc ( ) * 2 + 5 ) ) ; //overallocation in case argc is 0.
if ( strlen ( pass ) > digestsize * 2 )
{
for ( i = 0 ; pass [ digestsize * 2 + i ] & & i < sizeof ( time_t ) * 2 ; i + + )
{ //mixed endian for compat with ezquake
if ( ! ( i & 1 ) )
clienttime | = dehex ( pass [ digestsize * 2 + i ] ) < < ( ( ( i / 2 ) * 8 ) + 4 ) ;
else
clienttime | = dehex ( pass [ digestsize * 2 + i ] ) < < ( ( ( i / 2 ) * 8 ) + 0 ) ;
}
time ( & servertime ) ;
timediff = servertime - clienttime ;
//make sure the client's time is within our allowed bounds, to prevent (extreme) replay attacks.
if ( ! sv_crypt_rcon_clockskew . value | | ( timediff > = - sv_crypt_rcon_clockskew . ival & & timediff < = sv_crypt_rcon_clockskew . ival ) )
{
tokens [ 0 ] = Cmd_Argv ( 0 ) ;
tokens [ 1 ] = " " ;
tokens [ 2 ] = realpass ;
tokens [ 3 ] = pass + digestsize * 2 ;
tokens [ 4 ] = " " ;
for ( i = 0 ; i < Cmd_Argc ( ) - 2 ; i + + )
{
tokens [ 5 + i * 2 + 0 ] = Cmd_Argv ( i + 2 ) ;
tokens [ 5 + i * 2 + 1 ] = " " ; //a trailing space is required.
}
2020-03-25 21:29:30 +00:00
hashfunc - > init ( hashctx ) ;
2018-08-21 18:52:25 +00:00
for ( k = 0 ; k < 5 + i * 2 ; k + + )
2020-03-25 21:29:30 +00:00
hashfunc - > process ( hashctx , tokens [ k ] , strlen ( tokens [ k ] ) ) ;
hashfunc - > terminate ( digest , hashctx ) ;
for ( i = 0 ; ; i + + )
2018-08-21 18:52:25 +00:00
{
2020-03-25 21:29:30 +00:00
if ( i = = digestsize )
return true ;
if ( ! pass [ i * 2 + 0 ] | | ! pass [ i * 2 + 1 ] )
break ; //premature termination
b = dehex ( pass [ i * 2 + 0 ] ) * 16 + dehex ( pass [ i * 2 + 1 ] ) ;
if ( b ! = digest [ i ] )
break ;
2018-08-21 18:52:25 +00:00
}
}
}
}
2018-12-04 08:57:29 +00:00
return false ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = =
SVC_RemoteCommand
A client issued an rcon command .
Shift down the remaining args
Redirect all printfs
= = = = = = = = = = = = = = =
*/
void SVC_RemoteCommand ( void )
{
int i ;
char remaining [ 1024 ] ;
2008-06-08 14:37:57 +00:00
char adr [ MAX_ADR_SIZE ] ;
2019-03-23 07:06:37 +00:00
static unsigned int blockuntil ;
unsigned int curtime , inc = 1000 / sv_rconlim . value ;
2004-08-23 00:15:46 +00:00
2006-05-25 04:47:03 +00:00
{
2009-07-14 23:42:54 +00:00
char * br = SV_BannedReason ( & net_from ) ;
if ( br )
2006-05-25 04:47:03 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Rcon from banned ip %s: %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , br ) ;
2006-05-25 04:47:03 +00:00
return ;
}
}
2019-03-23 07:06:37 +00:00
if ( sv_rconlim . value > 0 )
2004-08-23 00:15:46 +00:00
{
2019-03-23 07:06:37 +00:00
curtime = Sys_Milliseconds ( ) ;
if ( 1000 < curtime - blockuntil )
blockuntil = curtime - 1000 ;
if ( inc > curtime - blockuntil )
return ; //throttle
}
if ( ! Rcon_Validate ( ) )
{
blockuntil + = inc ;
2014-06-24 03:02:32 +00:00
/*
2005-11-03 23:40:51 +00:00
# ifdef SVRANKING
2005-03-12 23:40:42 +00:00
if ( cmd_allowaccess . value ) //try and find a username, match the numeric password
2004-08-23 00:15:46 +00:00
{
2005-03-12 23:40:42 +00:00
int rid ;
char * s = Cmd_Argv ( 1 ) ;
char * colon = NULL , * c2 ;
rankstats_t stats ;
c2 = s ;
for ( ; ; )
2004-08-23 00:15:46 +00:00
{
2005-03-12 23:40:42 +00:00
c2 = strchr ( c2 , ' : ' ) ;
if ( ! c2 )
break ;
colon = c2 ;
c2 + + ;
}
if ( colon ) //oh, could this be a specific username?
{
* colon = ' \0 ' ;
colon + + ;
2011-09-03 03:49:43 +00:00
rid = Rank_GetPlayerID ( NULL , s , atoi ( colon ) , false , true ) ;
2005-03-12 23:40:42 +00:00
if ( rid )
{
if ( ! Rank_GetPlayerStats ( rid , & stats ) )
return ;
2004-08-23 00:15:46 +00:00
2005-07-03 15:16:20 +00:00
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Rcon from %s: \n %s \n "
2013-05-03 04:28:08 +00:00
, NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , net_message . data + 4 ) ;
2004-08-23 00:15:46 +00:00
2014-06-24 03:02:32 +00:00
SV_BeginRedirect ( RD_PACKET_LOG , svs . language ) ;
2004-08-23 00:15:46 +00:00
2005-03-12 23:40:42 +00:00
remaining [ 0 ] = 0 ;
2004-08-23 00:15:46 +00:00
2005-03-12 23:40:42 +00:00
for ( i = 2 ; i < Cmd_Argc ( ) ; i + + )
2004-08-23 00:15:46 +00:00
{
2005-03-12 23:40:42 +00:00
if ( strlen ( remaining ) + strlen ( Cmd_Argv ( i ) ) > = sizeof ( remaining ) - 2 )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Rcon was too long \n " ) ;
2005-03-12 23:40:42 +00:00
SV_EndRedirect ( ) ;
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Rcon from %s: \n %s \n "
2013-05-03 04:28:08 +00:00
, NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , " Was too long - possible buffer overflow attempt " ) ;
2005-03-12 23:40:42 +00:00
return ;
}
strcat ( remaining , Cmd_Argv ( i ) ) ;
strcat ( remaining , " " ) ;
2004-08-23 00:15:46 +00:00
}
2005-03-12 23:40:42 +00:00
Cmd_ExecuteString ( remaining , stats . trustlevel ) ;
2004-08-23 00:15:46 +00:00
2005-03-12 23:40:42 +00:00
SV_EndRedirect ( ) ;
return ;
}
2004-08-23 00:15:46 +00:00
}
}
2005-11-03 23:40:51 +00:00
# endif
2014-06-24 03:02:32 +00:00
*/
2004-08-23 00:15:46 +00:00
2014-06-24 03:02:32 +00:00
Log_String ( LOG_RCON , va ( " Bad rcon from %s: \t %s \n "
, NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , net_message . data + 4 ) ) ;
Con_TPrintf ( " Bad rcon from %s: \t %s \n "
2013-05-03 04:28:08 +00:00
, NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , net_message . data + 4 ) ;
2004-08-23 00:15:46 +00:00
2019-03-23 07:06:37 +00:00
if ( 1 )
return ;
2018-12-28 00:04:36 +00:00
SV_BeginRedirect ( RD_PACKET , com_language ) ;
2004-08-23 00:15:46 +00:00
2014-06-24 03:02:32 +00:00
Con_TPrintf ( " Bad rcon_password. Passwords might be logged. Be careful. \n " ) ;
2004-08-23 00:15:46 +00:00
}
else
{
2014-06-24 03:02:32 +00:00
//make sure stuff is flushed
cmd_blockwait = true ;
Cbuf_ExecuteLevel ( rcon_level . ival ) ;
cmd_blockwait = false ;
2004-08-23 00:15:46 +00:00
2014-06-24 03:02:32 +00:00
Log_String ( LOG_RCON , va ( " \n \n Rcon from %s: \t %s \n "
, NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , net_message . data + 4 ) ) ;
Con_TPrintf ( " Rcon from %s: \t %s \n "
2013-05-03 04:28:08 +00:00
, NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , net_message . data + 4 ) ;
2004-08-23 00:15:46 +00:00
2018-12-28 00:04:36 +00:00
SV_BeginRedirect ( RD_PACKET_LOG , com_language ) ;
2004-08-23 00:15:46 +00:00
remaining [ 0 ] = 0 ;
for ( i = 2 ; i < Cmd_Argc ( ) ; i + + )
{
if ( strlen ( remaining ) + strlen ( Cmd_Argv ( i ) ) > = sizeof ( remaining ) - 2 )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Rcon was too long \n " ) ;
2004-08-23 00:15:46 +00:00
SV_EndRedirect ( ) ;
2014-06-24 03:02:32 +00:00
Con_TPrintf ( " Rcon from %s: \t %s \n "
2013-05-03 04:28:08 +00:00
, NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , " Was too long - possible buffer overflow attempt " ) ;
2004-08-23 00:15:46 +00:00
return ;
}
2014-06-24 03:02:32 +00:00
Q_strncatz ( remaining , Cmd_Argv ( i ) , sizeof ( remaining ) ) ;
Q_strncatz ( remaining , " " , sizeof ( remaining ) ) ;
2004-08-23 00:15:46 +00:00
}
2014-06-24 03:02:32 +00:00
//make sure the wait command can't be used to fuck up our logs.
cmd_blockwait = true ;
Cbuf_AddText ( remaining , rcon_level . ival ) ;
Cbuf_ExecuteLevel ( rcon_level . ival ) ;
cmd_blockwait = false ;
2004-08-23 00:15:46 +00:00
}
SV_EndRedirect ( ) ;
}
2006-09-17 00:59:22 +00:00
void SVC_RealIP ( void )
{
unsigned int slotnum ;
int cookie ;
2009-07-14 23:42:54 +00:00
char * banreason ;
2008-06-08 14:37:57 +00:00
char adr [ MAX_ADR_SIZE ] ;
2008-05-25 22:23:43 +00:00
2006-09-17 00:59:22 +00:00
slotnum = atoi ( Cmd_Argv ( 1 ) ) ;
cookie = atoi ( Cmd_Argv ( 2 ) ) ;
2013-12-02 14:30:30 +00:00
if ( slotnum > = svs . allocated_client_slots )
2006-09-17 00:59:22 +00:00
{
//a malitious user
return ;
}
if ( cookie ! = svs . clients [ slotnum ] . realip_num )
{
//could be someone trying to kick someone else
//so we can't kick, as much as we might like to.
return ;
}
if ( svs . clients [ slotnum ] . realip_status )
return ;
2013-05-03 04:28:08 +00:00
if ( NET_AddressSmellsFunny ( & net_from ) )
2008-05-25 22:23:43 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " funny realip address: %s, " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
Con_TPrintf ( " proxy address: %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & svs . clients [ slotnum ] . netchan . remote_address ) ) ;
2008-05-25 22:23:43 +00:00
return ;
}
2009-07-14 23:42:54 +00:00
banreason = SV_BannedReason ( & net_from ) ;
if ( banreason )
2008-05-25 22:23:43 +00:00
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " %s has a banned realip \n " , svs . clients [ slotnum ] . name ) ;
2009-07-14 23:42:54 +00:00
if ( * banreason )
2013-11-29 14:36:47 +00:00
SV_ClientTPrintf ( & svs . clients [ slotnum ] , PRINT_CHAT , " You were banned. \n Reason: %s \n " , banreason ) ;
2008-05-25 22:23:43 +00:00
else
2013-11-29 14:36:47 +00:00
SV_ClientTPrintf ( & svs . clients [ slotnum ] , PRINT_CHAT , " You were banned. \n " ) ;
2008-05-25 22:23:43 +00:00
SV_DropClient ( & svs . clients [ slotnum ] ) ;
return ;
}
2006-09-17 00:59:22 +00:00
svs . clients [ slotnum ] . realip_status = 1 ;
svs . clients [ slotnum ] . realip = net_from ;
}
void SVC_ACK ( void )
{
int slotnum ;
2008-06-08 14:37:57 +00:00
char adr [ MAX_ADR_SIZE ] ;
2013-10-29 17:38:22 +00:00
for ( slotnum = 0 ; slotnum < svs . allocated_client_slots ; slotnum + + )
2006-09-17 00:59:22 +00:00
{
if ( svs . clients [ slotnum ] . state )
{
2013-05-03 04:28:08 +00:00
if ( svs . clients [ slotnum ] . realip_status = = 1 & & NET_CompareAdr ( & svs . clients [ slotnum ] . realip , & net_from ) )
2006-09-17 00:59:22 +00:00
{
if ( ! * Cmd_Argv ( 1 ) )
svs . clients [ slotnum ] . realip_status = 2 ;
else if ( atoi ( Cmd_Argv ( 1 ) ) = = svs . clients [ slotnum ] . realip_ping & &
atoi ( Cmd_Argv ( 2 ) ) = = svs . clients [ slotnum ] . realip_num )
{
svs . clients [ slotnum ] . realip_status = 3 ;
}
else
{
2013-05-03 04:28:08 +00:00
Netchan_OutOfBandPrint ( NS_SERVER , & net_from , " realip not accepted. Please stop hacking. \n " ) ;
2006-09-17 00:59:22 +00:00
}
return ;
}
}
}
2023-03-15 17:57:31 +00:00
Con_TPrintf ( S_COLOR_GRAY " A2A_ACK from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
2006-09-17 00:59:22 +00:00
}
2023-03-15 17:57:31 +00:00
# ifdef SUPPORT_ICE
void SVC_ICE_Offer ( void ) ;
void SVC_ICE_Candidate ( void ) ;
# endif
2012-04-24 07:59:11 +00:00
//returns false to block replies
2021-07-17 15:11:26 +00:00
//this is to mitigate wasted bandwidth if we're used as a udp amplification
2012-04-24 07:59:11 +00:00
qboolean SVC_ThrottleInfo ( void )
{
# define THROTTLE_PPS 20
static unsigned int blockuntil ;
2017-11-16 22:20:40 +00:00
unsigned int curtime , inc = 1000 / THROTTLE_PPS ;
2017-11-15 12:38:20 +00:00
2021-04-14 05:21:04 +00:00
if ( SV_Master_AddressIsMaster ( & net_from ) )
2017-11-15 12:38:20 +00:00
return true ; //allow it without contributing to any throttling.
curtime = Sys_Milliseconds ( ) ;
2012-04-24 07:59:11 +00:00
/*don't go too far back*/
//if (blockuntil < curtime - 1000)
if ( 1000 < curtime - blockuntil )
blockuntil = curtime - 1000 ;
/*don't allow it to go beyond curtime or we get issues with the logic above*/
if ( inc > curtime - blockuntil )
2013-03-12 22:13:26 +00:00
return false ;
2012-04-24 07:59:11 +00:00
blockuntil + = inc ;
2013-03-12 22:13:26 +00:00
return true ;
2012-04-24 07:59:11 +00:00
}
2021-07-17 15:11:26 +00:00
//more aggressive logic.
static struct attacker_s
{
int af ;
qbyte addr [ 16 ] ;
qboolean blocked ; //if we reach 10 status requests within 30 secs
double timeout ;
int count ;
} * dosattacker ;
static size_t dosattacker_count ;
static size_t dosattacker_max ;
2023-03-15 17:57:31 +00:00
# define dosattacker_limit 15 //if we get X packets
2021-07-17 15:11:26 +00:00
# define dosattacker_period 30 //within Y secs
# define dosattacker_blocktime (60*60*24) //block them for Z secs (24 hours).
static qboolean SV_DetectAmplificationDDOS ( void )
{
size_t at ;
double t = Sys_DoubleTime ( ) ;
int as ;
switch ( net_from . type ) //trying to be efficient and avoiding net_comparebaseaddr
{
case NA_IP : as = 4 ; break ;
case NA_IPX : as = 10 ; break ;
case NA_IPV6 : as = 16 ; break ;
default : as = 0 ; break ;
}
if ( as )
{
for ( at = 0 ; at < dosattacker_count ; at + + )
{ //look for an existing one
if ( net_from . type ! = dosattacker - > af )
continue ;
if ( ! memcmp ( dosattacker [ at ] . addr , & net_from . address , as ) )
{ //a match.
if ( t > dosattacker [ at ] . timeout )
{ //they survived, for now...
dosattacker [ at ] . count = 0 ;
dosattacker [ at ] . timeout = t + dosattacker_period ;
}
if ( + + dosattacker [ at ] . count > = dosattacker_limit )
{
if ( dosattacker [ at ] . count = = dosattacker_limit )
{
char buf [ 128 ] ;
Con_Printf ( CON_ERROR " %s: Presumed amplification ddos attack, blocking further status queries. \n " , NET_BaseAdrToString ( buf , sizeof ( buf ) , & net_from ) ) ;
Q_snprintfz ( buf , sizeof ( buf ) , " \xff \xff \xff \xff %cProbable ddos amplification attack \n " , A2C_PRINT ) ;
NET_SendPacket ( svs . sockets , strlen ( buf ) , buf , & net_from ) ;
dosattacker [ at ] . timeout = t + dosattacker_blocktime ; //a 24 hour block.
}
else //extend by a smidge...
dosattacker [ at ] . timeout + = dosattacker_period / ( double ) dosattacker_limit ;
return true ;
}
break ;
}
}
if ( at = = dosattacker_count )
{ //didn't find one
for ( at = 0 ; at < dosattacker_count ; at + + )
{ //try to find one to recycle
if ( t > dosattacker [ at ] . timeout )
break ;
}
if ( at = = dosattacker_count )
{
if ( at = = dosattacker_max )
{
if ( at > 4096 ) //should we be using hash tables?...
at - - ; //stomp on the last.
else
{
Z_ReallocElements ( ( void * * ) & dosattacker , & dosattacker_max , max ( 16 , dosattacker_count * 2 ) , sizeof ( dosattacker [ 0 ] ) ) ;
}
}
else
at = dosattacker_count + + ;
}
dosattacker [ at ] . af = net_from . type ;
memcpy ( dosattacker [ at ] . addr , & net_from . address , as ) ;
dosattacker [ at ] . count = 0 ;
dosattacker [ at ] . timeout = t + dosattacker_period ;
}
}
if ( SVC_ThrottleInfo ( ) )
return true ;
return false ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = =
SV_ConnectionlessPacket
A connectionless packet has four leading 0xff
characters to distinguish it from a game channel .
Clients that are in the game can still send
connectionless packets .
= = = = = = = = = = = = = = = = =
*/
qboolean SV_ConnectionlessPacket ( void )
{
char * s ;
char * c ;
2008-06-08 14:37:57 +00:00
char adr [ MAX_ADR_SIZE ] ;
2004-08-23 00:15:46 +00:00
2022-03-08 05:31:34 +00:00
MSG_BeginReading ( & net_message , svs . netprim ) ;
2004-08-23 00:15:46 +00:00
if ( net_message . cursize > = MAX_QWMSGLEN ) //add a null term in message space
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Oversized packet from %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) ) ;
2004-08-23 00:15:46 +00:00
net_message . cursize = MAX_QWMSGLEN - 1 ;
}
net_message . data [ net_message . cursize ] = ' \0 ' ; //terminate it properly. Just in case.
MSG_ReadLong ( ) ; // skip the -1 marker
s = MSG_ReadStringLine ( ) ;
2004-12-08 04:14:52 +00:00
Cmd_TokenizeString ( s , false , false ) ;
2004-08-23 00:15:46 +00:00
c = Cmd_Argv ( 0 ) ;
2014-08-03 14:47:47 +00:00
if ( sv_showconnectionlessmessages . ival )
2022-01-16 18:41:44 +00:00
Con_Printf ( S_COLOR_GRAY " %s: %s \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , s ) ;
2014-08-03 14:47:47 +00:00
2004-08-23 00:15:46 +00:00
if ( ! strcmp ( c , " ping " ) | | ( c [ 0 ] = = A2A_PING & & ( c [ 1 ] = = 0 | | c [ 1 ] = = ' \n ' ) ) )
2020-02-26 00:37:52 +00:00
{ //only continue respond to these if we're actually public. qwfwd likes spamming us endlessly even if we stop heartbeating (which leaves us discoverable to others, too).
if ( sv_public . ival > = 0 )
SVC_Ping ( ) ;
}
2004-08-23 00:15:46 +00:00
else if ( c [ 0 ] = = A2A_ACK & & ( c [ 1 ] = = 0 | | c [ 1 ] = = ' \n ' ) )
2006-09-17 00:59:22 +00:00
SVC_ACK ( ) ;
2004-08-23 00:15:46 +00:00
else if ( ! strcmp ( c , " status " ) )
2012-04-24 07:59:11 +00:00
{
2015-07-06 14:47:46 +00:00
if ( sv_public . ival > = 0 )
2021-07-17 15:11:26 +00:00
if ( SV_DetectAmplificationDDOS ( ) )
2015-07-06 14:47:46 +00:00
SVC_Status ( ) ;
2012-04-24 07:59:11 +00:00
}
2004-08-23 00:15:46 +00:00
else if ( ! strcmp ( c , " log " ) )
2012-04-24 07:59:11 +00:00
{
if ( SVC_ThrottleInfo ( ) )
SVC_Log ( ) ;
}
2005-07-03 15:16:20 +00:00
# ifdef Q2SERVER
2004-08-23 00:15:46 +00:00
else if ( ! strcmp ( c , " info " ) )
2012-04-24 07:59:11 +00:00
{
2015-07-06 14:47:46 +00:00
if ( sv_public . ival > = 0 )
2021-07-17 15:11:26 +00:00
if ( SV_DetectAmplificationDDOS ( ) )
2015-07-06 14:47:46 +00:00
SVC_InfoQ2 ( ) ;
2012-04-24 07:59:11 +00:00
}
2005-07-03 15:16:20 +00:00
# endif
2004-08-23 00:15:46 +00:00
else if ( ! strncmp ( c , " connect " , 7 ) )
{
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
if ( net_from . prot = = NP_DGRAM )
NET_DTLS_Disconnect ( svs . sockets , & net_from ) ;
# endif
2005-03-07 08:58:26 +00:00
# ifdef Q3SERVER
if ( svs . gametype = = GT_QUAKE3 )
{
2022-03-08 05:31:34 +00:00
q3 - > sv . DirectConnect ( & net_from , & net_message ) ;
2005-03-07 08:58:26 +00:00
return true ;
}
2008-11-09 22:29:28 +00:00
2017-05-18 10:24:09 +00:00
# ifdef QWOVERQ3
2014-10-05 20:04:11 +00:00
if ( sv_listen_q3 . ival )
2008-11-09 22:29:28 +00:00
{
if ( ! strstr ( s , " \\ name \\ " ) )
{ //if name isn't in the string, assume they're q3
//this isn't quite true though, hence the listen check. but users shouldn't be connecting with an empty name anyway. more fool them.
2014-05-10 13:42:13 +00:00
# ifdef HUFFNETWORK
2008-11-09 22:29:28 +00:00
Huff_DecryptPacket ( & net_message , 12 ) ;
2014-05-10 13:42:13 +00:00
# endif
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
MSG_BeginReading ( svs . netprim ) ;
2008-11-09 22:29:28 +00:00
MSG_ReadLong ( ) ;
s = MSG_ReadStringLine ( ) ;
Cmd_TokenizeString ( s , false , false ) ;
}
}
2005-03-07 08:58:26 +00:00
# endif
2017-05-18 10:24:09 +00:00
# endif
if ( secure . value ) //FIXME: possible problem for nq clients when enabled
2008-11-09 22:29:28 +00:00
{
2018-12-28 00:04:36 +00:00
Netchan_OutOfBandTPrintf ( NS_SERVER , & net_from , com_language , " %c \n This server requires client validation. \n Please use the " FULLENGINENAME " validation program \n " , A2C_PRINT ) ;
2008-11-09 22:29:28 +00:00
}
2004-08-23 00:15:46 +00:00
else
{
2019-07-02 04:12:20 +00:00
SVC_DirectConnect ( 0 ) ;
2004-08-23 00:15:46 +00:00
return true ;
}
}
2017-05-18 10:24:09 +00:00
else if ( ! strcmp ( c , " dtlsconnect " ) )
2022-02-07 14:34:11 +00:00
{ //NOTE: redundant. if the server has dtls enabled then it'll respond to dtls hellos with its own stateless cookies
2017-05-18 10:24:09 +00:00
# ifdef HAVE_DTLS
2018-03-24 04:02:09 +00:00
if ( net_from . prot = = NP_DGRAM & & ( net_enable_dtls . ival /*|| !*net_enable_dtls.ival*/ ) )
2017-05-18 10:24:09 +00:00
{
2020-06-12 23:29:58 +00:00
if ( * Cmd_Argv ( 2 ) )
SV_RejectMessage ( SCP_QUAKEWORLD , " Proxying not enabled. \n " ) ; //server would be expected to getchallenge+dtlsconnect the target server (or respond with a no-dtls challenge response...)
else if ( SV_ChallengePasses ( atoi ( Cmd_Argv ( 1 ) ) ) )
2017-05-18 10:24:09 +00:00
{
char * banreason = SV_BannedReason ( & net_from ) ;
if ( banreason )
{
if ( * banreason )
SV_RejectMessage ( SCP_QUAKEWORLD , " You were banned. \n Reason: %s \n " , banreason ) ;
else
SV_RejectMessage ( SCP_QUAKEWORLD , " You were banned. \n " ) ;
}
else
{
//NET_DTLS_Disconnect(svs.sockets, &net_from);
2023-03-15 17:57:31 +00:00
if ( NET_DTLS_Create ( svs . sockets , & net_from , NULL , false ) )
2017-05-18 10:24:09 +00:00
Netchan_OutOfBandPrint ( NS_SERVER , & net_from , " dtlsopened " ) ;
2023-03-15 17:57:31 +00:00
else
SV_RejectMessage ( SCP_QUAKEWORLD , " DTLS driver failure. \n " ) ;
2017-05-18 10:24:09 +00:00
}
}
else
SV_RejectMessage ( SCP_QUAKEWORLD , " Bad challenge. \n " ) ;
}
return true ;
# endif
2005-08-03 23:14:59 +00:00
}
2017-05-18 10:24:09 +00:00
/*else if (!strcmp(c,"\xad\xad\xad\xad""getchallenge"))
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
SVC_GetChallenge ( false ) ;
2017-05-18 10:24:09 +00:00
} */
else if ( ! strcmp ( c , " getchallenge " ) )
{
2022-07-28 02:17:27 +00:00
//qw+q2 sends "\xff\xff\xff\xffgetchallenge\n"
//dp+q3 sends "\xff\xff\xff\xffgetchallenge"
//ioq3 sends "\xff\xff\xff\xffgetchallenge <clientchallenge> <$com_gamename>"
2017-05-18 10:24:09 +00:00
//its a subtle difference, but means we can avoid wasteful spam for real qw clients.
SVC_GetChallenge ( ( net_message . cursize = = 16 ) ? true : false ) ;
2004-08-23 00:15:46 +00:00
}
2009-04-01 22:03:56 +00:00
else if ( ! strcmp ( c , " getstatus " ) )
2019-03-23 07:06:37 +00:00
{ //q3/dpmaster support
2015-07-06 14:47:46 +00:00
if ( sv_public . ival > = 0 )
2021-07-17 15:11:26 +00:00
if ( SV_DetectAmplificationDDOS ( ) )
2015-07-06 14:47:46 +00:00
SVC_GetInfo ( Cmd_Args ( ) , true ) ;
2012-04-24 07:59:11 +00:00
}
2005-05-26 12:55:34 +00:00
else if ( ! strcmp ( c , " getinfo " ) )
2019-03-23 07:06:37 +00:00
{ //q3/dpmaster support
2015-07-06 14:47:46 +00:00
if ( sv_public . ival > = 0 )
2021-04-14 05:21:04 +00:00
{
const char * chal = Cmd_Args ( ) ;
SV_Master_HeartbeatResponse ( & net_from , chal ) ;
2021-07-17 15:11:26 +00:00
if ( SV_DetectAmplificationDDOS ( ) )
2021-04-14 05:21:04 +00:00
SVC_GetInfo ( chal , false ) ;
}
2012-04-24 07:59:11 +00:00
}
2004-08-23 00:15:46 +00:00
else if ( ! strcmp ( c , " rcon " ) )
2019-03-23 07:06:37 +00:00
{
2021-07-17 15:11:26 +00:00
if ( SV_DetectAmplificationDDOS ( ) )
2019-03-23 07:06:37 +00:00
SVC_RemoteCommand ( ) ;
}
else if ( ! strcmp ( c , " realip " ) | | ! strcmp ( c , " ip " ) )
2006-09-17 00:59:22 +00:00
SVC_RealIP ( ) ;
2023-03-15 17:57:31 +00:00
# ifdef SUPPORT_ICE
else if ( ! strcmp ( c , " ice_offer " ) )
SVC_ICE_Offer ( ) ;
else if ( ! strcmp ( c , " ice_ccand " ) )
SVC_ICE_Candidate ( ) ;
# endif
2019-03-23 07:06:37 +00:00
/*
else if ( ! strcmp ( c , " lastscores " ) )
{
if ( SVC_ThrottleInfo ( ) )
SVC_LastScores ( ) ;
}
else if ( ! strcmp ( c , " dlist " ) | | ! strcmp ( c , " demolist " ) )
{
if ( SVC_ThrottleInfo ( ) )
SVC_DemoList ( ) ;
}
else if ( ! strcmp ( c , " dlistr " ) | | ! strcmp ( c , " dlistregex " ) | | ! strcmp ( c , " demolistr " ) | | ! strcmp ( c , " demolistregex " ) )
{
if ( SVC_ThrottleInfo ( ) )
SVC_DemoListRegex ( ) ;
}
2019-06-17 04:21:41 +00:00
*/
# ifdef MVD_RECORDING
2019-03-23 07:06:37 +00:00
else if ( ! strcmp ( c , " qtvusers " ) )
{
if ( SVC_ThrottleInfo ( ) )
SVC_QTVUsers ( ) ;
}
2019-06-17 04:21:41 +00:00
# endif
2006-01-21 00:06:49 +00:00
else if ( ! PR_GameCodePacket ( net_message . data + 4 ) )
2011-10-27 16:16:29 +00:00
{
static unsigned int lt ;
unsigned int ct = Sys_Milliseconds ( ) ;
if ( ct - lt > 5 * 1000 )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " bad connectionless packet from %s: \" %s \" \n " , NET_AdrToString ( adr , sizeof ( adr ) , & net_from ) , c ) ;
2011-10-27 16:16:29 +00:00
lt = ct ;
}
}
2004-08-23 00:15:46 +00:00
return false ;
}
2005-06-14 04:52:10 +00:00
# ifdef NQPROT
2013-03-31 04:21:08 +00:00
qboolean SVNQ_ConnectionlessPacket ( void )
2005-05-26 12:55:34 +00:00
{
sizebuf_t sb ;
int header ;
int length ;
2022-01-08 10:01:15 +00:00
int active , i , protver ;
2011-06-16 02:03:57 +00:00
int mod , modver , flags ;
unsigned int passwd ;
2005-05-26 12:55:34 +00:00
char * str ;
2010-11-07 02:17:45 +00:00
char buffer [ 256 ] , buffer2 [ 256 ] ;
netadr_t localaddr ;
2014-03-30 08:55:06 +00:00
char * banreason ;
2017-05-18 10:24:09 +00:00
2005-06-04 04:20:20 +00:00
if ( net_from . type = = NA_LOOPBACK )
2013-03-31 04:21:08 +00:00
return false ;
2005-06-04 04:20:20 +00:00
2014-09-02 02:44:43 +00:00
if ( ! sv_listen_nq . value | | SSV_IsSubServer ( ) )
2013-03-31 04:21:08 +00:00
return false ;
2005-05-26 12:55:34 +00:00
2022-03-08 05:31:34 +00:00
MSG_BeginReading ( & net_message , svs . netprim ) ;
2005-07-29 22:26:43 +00:00
header = LongSwap ( MSG_ReadLong ( ) ) ;
2005-05-26 12:55:34 +00:00
if ( ! ( header & NETFLAG_CTL ) )
2011-12-05 15:23:40 +00:00
{
2013-03-31 04:21:08 +00:00
//this nasty chunk of code is to try to handle challenges with nq's challengeless protocol, by using stringcmds. woo. evil hacks.
2011-12-05 15:23:40 +00:00
if ( sv_listen_nq . ival = = 2 )
if ( ( header & ( NETFLAG_DATA | NETFLAG_EOM ) ) = = ( NETFLAG_DATA | NETFLAG_EOM ) )
{
int sequence ;
2014-03-30 08:55:06 +00:00
if ( SV_BannedReason ( & net_from ) )
return false ; //just in case.
2011-12-05 15:23:40 +00:00
sequence = LongSwap ( MSG_ReadLong ( ) ) ;
if ( sequence < = 1 )
{
int numnops = 0 ;
int numnonnops = 0 ;
2022-03-08 05:34:26 +00:00
int c ;
2011-12-05 15:23:40 +00:00
/*make it at least robust enough to ignore any other stringcmds*/
while ( 1 )
{
switch ( MSG_ReadByte ( ) )
{
case clc_nop :
numnops + + ;
continue ;
case clc_stringcmd :
numnonnops + + ;
2022-03-08 05:34:26 +00:00
# define CCON "challengeconnect "
for ( i = 0 ; ; i + + )
{
if ( ! CCON [ i ] )
c = - 1 ;
else
c = MSG_ReadByte ( ) ;
if ( c ! = CCON [ i ] )
break ;
}
if ( ! CCON [ i ] )
2011-12-05 15:23:40 +00:00
{
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( sv_showconnectionlessmessages . ival )
2022-01-16 18:41:44 +00:00
Con_Printf ( S_COLOR_GRAY " %s: CCREQ_CONNECT_COOKIE \n " , NET_AdrToString ( com_token , sizeof ( com_token ) , & net_from ) ) ;
2013-03-12 22:44:00 +00:00
Cmd_TokenizeString ( MSG_ReadStringLine ( ) , false , false ) ;
2011-12-05 15:23:40 +00:00
/*okay, so this is a reliable packet from a client, containing a 'cmd challengeconnect $challenge' response*/
2022-03-08 05:34:26 +00:00
str = va ( " connect %i %i %s \" \\ name \\ unconnected \\ mod \\ %s \\ modver \\ %s \\ flags \\ %s \\ password \\ %s \" " , NQ_NETCHAN_VERSION , 0 , Cmd_Argv ( 0 ) , Cmd_Argv ( 1 ) , Cmd_Argv ( 2 ) , Cmd_Argv ( 3 ) , Cmd_Argv ( 4 ) ) ;
2011-12-05 15:23:40 +00:00
Cmd_TokenizeString ( str , false , false ) ;
2019-07-02 04:12:20 +00:00
SVC_DirectConnect ( sequence ) ;
2011-12-05 15:23:40 +00:00
/*if there is anything else in the packet, we don't actually care. its reliable, so they'll resend*/
2013-03-31 04:21:08 +00:00
return true ;
2011-12-05 15:23:40 +00:00
}
2022-03-08 05:34:26 +00:00
else if ( c ) //handle any trailing stuff if we don't know what it was.
2013-03-12 22:44:00 +00:00
MSG_ReadString ( ) ;
2011-12-05 15:23:40 +00:00
continue ;
case - 1 :
break ;
default :
numnonnops + + ;
break ;
}
break ;
}
if ( numnops & & ! numnonnops )
{
sb . maxsize = sizeof ( buffer ) ;
sb . data = buffer ;
/*ack it, so dumb proquake clones can actually send the proper packet*/
2015-06-20 14:22:06 +00:00
if ( ! sequence )
{
SZ_Clear ( & sb ) ;
MSG_WriteLong ( & sb , BigLong ( NETFLAG_ACK | 8 ) ) ;
MSG_WriteLong ( & sb , sequence ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2015-06-20 14:22:06 +00:00
}
2011-12-05 15:23:40 +00:00
2012-10-01 14:29:44 +00:00
/*resend the cmd request, cos if they didn't send it then it must have gotten dropped.
at this point , we assume its a proquake clone and that it already thinks that we are proquake
a vanilla client will not start spamming nops until it has received the server info , so its only the proquake clients + clones that will send a nop before a challengeconnect
unfortunatly we don ' t know the modver + flags + password any more . I hope its not needed . if it does , server admins will be forced to use sv_listen_nq 1 instead of 2 */
2011-12-05 15:23:40 +00:00
SZ_Clear ( & sb ) ;
2015-06-20 14:22:06 +00:00
MSG_WriteLong ( & sb , BigLong ( 0 ) ) ;
MSG_WriteLong ( & sb , BigLong ( 1 ) ) ; //sequence 1, because 0 matches the old sequence, and thus might get dropped. hopefully the client will cope with dupes properly and ignore any regular (but unreliable) stuff.
2011-12-05 15:23:40 +00:00
MSG_WriteByte ( & sb , svc_stufftext ) ;
2018-01-03 04:40:06 +00:00
MSG_WriteString ( & sb , va ( " cmd challengeconnect %i %i \n " , SV_NewChallenge ( ) , MOD_PROQUAKE ) ) ;
2011-12-05 15:23:40 +00:00
* ( int * ) sb . data = BigLong ( NETFLAG_UNRELIABLE | sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2013-03-31 04:21:08 +00:00
return true ;
2011-12-05 15:23:40 +00:00
}
}
}
2013-03-31 04:21:08 +00:00
return false ; //no idea what it is.
2011-12-05 15:23:40 +00:00
}
2005-05-26 12:55:34 +00:00
length = header & NETFLAG_LENGTH_MASK ;
if ( length ! = net_message . cursize )
2013-03-31 04:21:08 +00:00
return false ; //corrupt or not ours
2005-05-26 12:55:34 +00:00
switch ( MSG_ReadByte ( ) )
{
case CCREQ_CONNECT :
2022-01-08 10:01:15 +00:00
str = MSG_ReadString ( ) ;
protver = MSG_ReadByte ( ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( sv_showconnectionlessmessages . ival )
2022-01-16 18:41:44 +00:00
Con_Printf ( S_COLOR_GRAY " %s: CCREQ_CONNECT ( \" %s \" %i) \n " , NET_AdrToString ( com_token , sizeof ( com_token ) , & net_from ) , str , protver ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
2005-05-26 12:55:34 +00:00
sb . maxsize = sizeof ( buffer ) ;
sb . data = buffer ;
2022-01-08 10:01:15 +00:00
if ( strcmp ( str , NQ_NETCHAN_GAMENAME ) )
2005-05-26 12:55:34 +00:00
{
SZ_Clear ( & sb ) ;
MSG_WriteLong ( & sb , 0 ) ;
MSG_WriteByte ( & sb , CCREP_REJECT ) ;
MSG_WriteString ( & sb , " Incorrect game \n " ) ;
* ( int * ) sb . data = BigLong ( NETFLAG_CTL + sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2022-08-07 23:49:33 +00:00
return true ; //not our game.
2005-05-26 12:55:34 +00:00
}
2022-01-08 10:01:15 +00:00
if ( protver ! = NQ_NETCHAN_VERSION & & protver ! = NQ_NETCHAN_VERSION_QEX )
2005-05-26 12:55:34 +00:00
{
SZ_Clear ( & sb ) ;
MSG_WriteLong ( & sb , 0 ) ;
MSG_WriteByte ( & sb , CCREP_REJECT ) ;
MSG_WriteString ( & sb , " Incorrect version \n " ) ;
* ( int * ) sb . data = BigLong ( NETFLAG_CTL + sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2022-08-07 23:49:33 +00:00
return true ; //not our version...
2005-05-26 12:55:34 +00:00
}
2014-03-30 08:55:06 +00:00
banreason = SV_BannedReason ( & net_from ) ;
if ( banreason )
{
SZ_Clear ( & sb ) ;
MSG_WriteLong ( & sb , 0 ) ;
MSG_WriteByte ( & sb , CCREP_REJECT ) ;
MSG_WriteString ( & sb , * banreason ? va ( " You are banned: %s \n " , banreason ) : " You are banned \n " ) ;
* ( int * ) sb . data = BigLong ( NETFLAG_CTL + sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2022-08-07 23:49:33 +00:00
return true ; //not our version...
2014-03-30 08:55:06 +00:00
}
2022-01-08 10:01:15 +00:00
//proquake's extensions
2011-06-16 02:03:57 +00:00
mod = MSG_ReadByte ( ) ;
modver = MSG_ReadByte ( ) ;
flags = MSG_ReadByte ( ) ;
passwd = MSG_ReadLong ( ) ;
2022-08-07 23:49:33 +00:00
if ( msg_badread )
passwd = 0 ;
2005-05-26 12:55:34 +00:00
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
if ( SV_ChallengeRecent ( ) )
return true ;
2022-07-28 02:17:27 +00:00
Cmd_TokenizeString ( MSG_ReadString ( ) , false , false ) ;
if ( ! strcmp ( Cmd_Argv ( 0 ) , " getchallenge " ) & & ( sv_listen_qw . ival | | sv_listen_dp . ival ) )
2011-06-16 02:03:57 +00:00
{
/*dual-stack client, supporting either DP or QW protocols*/
2017-05-18 10:24:09 +00:00
SVC_GetChallenge ( false ) ;
2011-06-16 02:03:57 +00:00
}
2023-02-20 08:35:56 +00:00
# ifdef HAVE_DTLS
else if ( net_enable_dtls . ival > 2 & & ( net_from . prot = = NP_DGRAM | | net_from . prot = = NP_STREAM | | net_from . prot = = NP_WS ) & & net_from . type ! = NA_LOOPBACK & & ! NET_IsEncrypted ( & net_from ) )
{
SV_RejectMessage ( SCP_NETQUAKE , " This server requires the use of DTLS/TLS/WSS. \n " ) ;
return true ;
}
# endif
2011-06-16 02:03:57 +00:00
else
2022-07-28 02:17:27 +00:00
{ //legacy pure-nq (though often DP).
2016-07-12 00:40:13 +00:00
if ( progstype = = PROG_H2 )
{
2023-02-20 08:35:56 +00:00
SV_RejectMessage ( SCP_NETQUAKE , " NQ clients are not supported with hexen2 gamecode \n " ) ;
2022-08-07 23:49:33 +00:00
return true ; //not our version...
2016-07-12 00:40:13 +00:00
}
2022-08-07 23:49:33 +00:00
if ( NET_WasSpecialPacket ( svs . sockets ) )
return true ;
2022-08-19 13:29:27 +00:00
# ifdef HAVE_PACKET
if ( sv_listen_nq . ival = = 2 & & net_from . prot = = NP_DGRAM
# ifdef SUPPORT_ICE
& & net_from . type ! = NA_ICE
# endif
)
2011-12-05 15:23:40 +00:00
{
2022-08-07 23:49:33 +00:00
if ( password . string [ 0 ] & &
2023-08-08 18:28:53 +00:00
stricmp ( password . string , " none " ) )
2022-08-07 23:49:33 +00:00
{ //make sure we don't get crippled because of being unable to specify the actual password with proquake's stuff.
2023-08-08 18:28:53 +00:00
char * e ;
intmax_t svpass = strtoll ( password . string , & e , 0 ) ;
if ( * e ) //something ain't numeric... hash it so they have a chance of getting it right...
svpass = CalcHashInt ( & hash_md4 , password . string , strlen ( password . string ) ) ;
if ( passwd ! = svpass )
{
Con_TPrintf ( " %s:password failed (nq) \n " , NET_AdrToString ( buffer2 , sizeof ( buffer2 ) , & net_from ) ) ;
SV_RejectMessage ( SCP_NETQUAKE , " \x01 this server requires a password \n \n " ) ;
//and prevent them from spamming attempts. botnets might still get through fast though.
SV_AutoBanSender ( 15 , " password cooldown " ) ;
return true ;
}
2022-08-07 23:49:33 +00:00
}
2011-12-05 15:23:40 +00:00
SZ_Clear ( & sb ) ;
MSG_WriteLong ( & sb , 0 ) ;
MSG_WriteByte ( & sb , CCREP_ACCEPT ) ;
NET_LocalAddressForRemote ( svs . sockets , & net_from , & localaddr , 0 ) ;
MSG_WriteLong ( & sb , ShortSwap ( localaddr . port ) ) ;
2018-01-03 04:40:06 +00:00
MSG_WriteByte ( & sb , MOD_PROQUAKE ) ;
MSG_WriteByte ( & sb , MOD_PROQUAKE_VERSION ) ;
2011-12-05 15:23:40 +00:00
* ( int * ) sb . data = BigLong ( NETFLAG_CTL | sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2011-06-16 02:03:57 +00:00
2011-12-05 15:23:40 +00:00
SZ_Clear ( & sb ) ;
2015-06-20 14:22:06 +00:00
MSG_WriteLong ( & sb , BigLong ( 0 ) ) ;
MSG_WriteLong ( & sb , BigLong ( 1 ) ) ; //sequence 1, because 0 matches the old sequence, and thus might get dropped. hopefully the client will cope with dupes properly and ignore any regular (but unreliable) stuff.
2011-12-05 15:23:40 +00:00
MSG_WriteByte ( & sb , svc_stufftext ) ;
2012-10-01 14:29:44 +00:00
MSG_WriteString ( & sb , va ( " cmd challengeconnect %i %i %i %i %i \n " , SV_NewChallenge ( ) , mod , modver , flags , passwd ) ) ;
2011-12-05 15:23:40 +00:00
* ( int * ) sb . data = BigLong ( NETFLAG_UNRELIABLE | sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2011-12-05 15:23:40 +00:00
/*don't worry about repeating, the nop case above will recover it*/
}
else
2022-08-19 13:29:27 +00:00
# endif
2011-12-05 15:23:40 +00:00
{
2022-01-08 10:01:15 +00:00
str = va ( " connect %i %i %i \" \\ name \\ unconnected \\ mod \\ %i \\ modver \\ %i \\ flags \\ %i \\ password \\ %i \" " , protver , 0 , SV_NewChallenge ( ) , mod , modver , flags , passwd ) ;
2011-12-05 15:23:40 +00:00
Cmd_TokenizeString ( str , false , false ) ;
2019-07-02 04:12:20 +00:00
SVC_DirectConnect ( 0 ) ;
2011-12-05 15:23:40 +00:00
}
2011-06-16 02:03:57 +00:00
}
2013-03-31 04:21:08 +00:00
return true ;
2010-11-07 02:17:45 +00:00
case CCREQ_SERVER_INFO :
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( sv_showconnectionlessmessages . ival )
2022-01-16 18:41:44 +00:00
Con_Printf ( S_COLOR_GRAY " %s: CCREQ_SERVER_INFO \n " , NET_AdrToString ( com_token , sizeof ( com_token ) , & net_from ) ) ;
2015-07-06 14:47:46 +00:00
if ( sv_public . ival < 0 )
return false ;
2014-03-30 08:55:06 +00:00
if ( SV_BannedReason ( & net_from ) )
return false ;
2014-12-23 15:26:42 +00:00
if ( Q_strcmp ( MSG_ReadString ( ) , NQ_NETCHAN_GAMENAME ) ! = 0 )
2013-03-31 04:21:08 +00:00
return false ;
2010-11-07 02:17:45 +00:00
sb . maxsize = sizeof ( buffer ) ;
sb . data = buffer ;
SZ_Clear ( & sb ) ;
// save space for the header, filled in later
MSG_WriteLong ( & sb , 0 ) ;
MSG_WriteByte ( & sb , CCREP_SERVER_INFO ) ;
if ( NET_LocalAddressForRemote ( svs . sockets , & net_from , & localaddr , 0 ) )
2013-05-03 04:28:08 +00:00
MSG_WriteString ( & sb , NET_AdrToString ( buffer2 , sizeof ( buffer2 ) , & localaddr ) ) ;
2010-11-07 02:17:45 +00:00
else
MSG_WriteString ( & sb , " unknown " ) ;
active = 0 ;
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
if ( svs . clients [ i ] . state )
active + + ;
MSG_WriteString ( & sb , hostname . string ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
MSG_WriteString ( & sb , svs . name ) ;
2010-11-07 02:17:45 +00:00
MSG_WriteByte ( & sb , active ) ;
MSG_WriteByte ( & sb , maxclients . value ) ;
2014-12-23 15:26:42 +00:00
MSG_WriteByte ( & sb , NQ_NETCHAN_VERSION ) ;
2010-11-07 02:17:45 +00:00
* ( int * ) sb . data = BigLong ( NETFLAG_CTL + sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2013-03-31 04:21:08 +00:00
return true ;
2010-11-28 19:12:50 +00:00
case CCREQ_PLAYER_INFO :
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( sv_showconnectionlessmessages . ival )
2022-01-16 18:41:44 +00:00
Con_Printf ( S_COLOR_GRAY " %s: CCREQ_PLAYER_INFO \n " , NET_AdrToString ( com_token , sizeof ( com_token ) , & net_from ) ) ;
2015-07-06 14:47:46 +00:00
if ( sv_public . ival < 0 )
return false ;
2014-03-30 08:55:06 +00:00
if ( SV_BannedReason ( & net_from ) )
return false ;
2010-11-28 19:12:50 +00:00
/*one request per player, ouch ouch ouch, what will it make of 32 players, I wonder*/
sb . maxsize = sizeof ( buffer ) ;
sb . data = buffer ;
// save space for the header, filled in later
SZ_Clear ( & sb ) ;
MSG_WriteLong ( & sb , 0 ) ;
{
unsigned int pno ;
client_t * cl ;
pno = MSG_ReadByte ( ) ;
if ( pno > = sv . allocated_client_slots )
break ;
cl = & svs . clients [ pno ] ;
if ( cl - > state < = cs_zombie )
break ;
MSG_WriteByte ( & sb , CCREP_PLAYER_INFO ) ;
MSG_WriteByte ( & sb , pno ) ;
MSG_WriteString ( & sb , cl - > name ) ;
MSG_WriteLong ( & sb , cl - > playercolor ) ;
MSG_WriteLong ( & sb , cl - > old_frags ) ;
MSG_WriteLong ( & sb , realtime - cl - > connection_started ) ;
2017-02-11 16:14:06 +00:00
MSG_WriteString ( & sb , SV_PlayerPublicAddress ( cl ) ) ; /*player's address, leave blank, don't spam that info as it can result in personal attacks exploits*/
2010-11-28 19:12:50 +00:00
}
* ( int * ) sb . data = BigLong ( NETFLAG_CTL + sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2013-03-31 04:21:08 +00:00
return true ;
2010-11-28 19:12:50 +00:00
case CCREQ_RULE_INFO :
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( sv_showconnectionlessmessages . ival )
2022-01-16 18:41:44 +00:00
Con_Printf ( S_COLOR_GRAY " %s: CCREQ_RULE_INFO \n " , NET_AdrToString ( com_token , sizeof ( com_token ) , & net_from ) ) ;
2015-07-06 14:47:46 +00:00
if ( sv_public . ival < 0 )
return false ;
2014-03-30 08:55:06 +00:00
if ( SV_BannedReason ( & net_from ) )
return false ;
2010-11-28 19:12:50 +00:00
/*lol, nq is evil*/
sb . maxsize = sizeof ( buffer ) ;
sb . data = buffer ;
// save space for the header, filled in later
SZ_Clear ( & sb ) ;
MSG_WriteLong ( & sb , 0 ) ;
{
2018-07-05 16:21:44 +00:00
const char * rname , * rval , * kname ;
2010-11-28 19:12:50 +00:00
rname = MSG_ReadString ( ) ;
if ( ! * rname )
2018-07-05 16:21:44 +00:00
rname = InfoBuf_KeyForNumber ( & svs . info , 0 ) ;
2010-11-28 19:12:50 +00:00
else
{
int i = 0 ;
for ( ; ; )
{
2018-07-05 16:21:44 +00:00
kname = InfoBuf_KeyForNumber ( & svs . info , i ) ;
if ( ! kname )
2010-11-28 19:12:50 +00:00
{
rname = NULL ;
break ;
}
i + + ;
if ( ! strcmp ( kname , rname ) )
{
2018-07-05 16:21:44 +00:00
rname = InfoBuf_KeyForNumber ( & svs . info , i ) ;
2010-11-28 19:12:50 +00:00
break ;
}
}
}
2018-07-05 16:21:44 +00:00
if ( rname )
rval = InfoBuf_ValueForKey ( & svs . info , rname ) ;
else
rval = rname = " " ;
2010-11-28 19:12:50 +00:00
MSG_WriteByte ( & sb , CCREP_RULE_INFO ) ;
MSG_WriteString ( & sb , rname ) ;
MSG_WriteString ( & sb , rval ) ;
}
* ( int * ) sb . data = BigLong ( NETFLAG_CTL + sb . cursize ) ;
2018-12-28 00:04:36 +00:00
NET_SendPacket ( svs . sockets , sb . cursize , sb . data , & net_from ) ;
2013-03-31 04:21:08 +00:00
return true ;
2005-05-26 12:55:34 +00:00
}
2013-03-31 04:21:08 +00:00
return false ;
2005-05-26 12:55:34 +00:00
}
2005-06-14 04:52:10 +00:00
# endif
2005-05-26 12:55:34 +00:00
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
PACKET FILTERING
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
You can add or remove addresses from the filter list with :
addip < ip >
removeip < ip >
The ip address is specified in dot format , and any unspecified digits will match any value , so you can specify an entire class C network with " addip 192.246.40 " .
Removeip will only remove an address specified exactly the same way . You cannot addip a subnet , then removeip a single host .
listip
Prints the current list of filters .
writeip
Dumps " addip <ip> " commands to listip . cfg so it can be execed at a later date . The filter lists are not saved and restored by default , because I beleive it would cause too much confusion .
filterban < 0 or 1 >
If 1 ( the default ) , then ip addresses matching the current list will be prohibited from entering the game . This is the default setting .
If 0 , then only addresses matching the list will be allowed . This lets you easily set up a private game , or a game that only allows players from your local network .
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
cvar_t filterban = CVARD ( " filterban " , " 1 " , " If 0, players will be kicked by default unless there is a rule that allows them. Also affects the default action of addip. " ) ;
2006-05-25 04:47:03 +00:00
2004-08-23 00:15:46 +00:00
//send a network packet to a new non-connected client.
//this is to combat tunneling
void SV_OpenRoute_f ( void )
{
netadr_t to ;
char data [ 64 ] ;
2016-02-15 06:01:17 +00:00
if ( NET_StringToAdr ( Cmd_Argv ( 1 ) , PORT_QWCLIENT , & to ) )
{
sprintf ( data , " \xff \xff \xff \xff %c " , S2C_CONNECTION ) ;
2004-08-23 00:15:46 +00:00
2016-02-15 06:01:17 +00:00
Netchan_OutOfBandPrint ( NS_SERVER , & to , " hello " ) ;
// NET_SendPacket (strlen(data)+1, data, to);
}
2004-08-23 00:15:46 +00:00
}
//============================================================================
2020-02-26 00:37:52 +00:00
static int inboundsequence ; //so we can detect frames when we didn't get any packets, even when packets come from epoll
void SV_ReadPacket ( void )
{
int i ;
client_t * cl ;
int qport ;
char * banreason ;
// check for connectionless packet (0xffffffff) first
if ( * ( unsigned int * ) net_message . data = = ~ 0 )
{
banreason = SV_BannedReason ( & net_from ) ;
if ( banreason )
{
static unsigned int lt ;
unsigned int ct = Sys_Milliseconds ( ) ;
if ( ct - lt > 5 * 1000 )
{
if ( * banreason )
Netchan_OutOfBandTPrintf ( NS_SERVER , & net_from , com_language , " You are banned: %s \n " , banreason ) ;
else
Netchan_OutOfBandTPrintf ( NS_SERVER , & net_from , com_language , " You are banned \n " ) ;
}
return ;
}
2022-08-07 23:49:33 +00:00
if ( NET_WasSpecialPacket ( svs . sockets ) ) //fixes up IP->ICE addresses (so we don't break when routes change).
return ;
2020-02-26 00:37:52 +00:00
SV_ConnectionlessPacket ( ) ;
return ;
}
# ifdef HAVE_DTLS
else
{
if ( NET_DTLS_Decode ( svs . sockets ) )
{
if ( ! net_message . cursize )
return ;
if ( * ( unsigned int * ) net_message . data = = ~ 0 )
{
SV_ConnectionlessPacket ( ) ;
return ;
}
}
}
# endif
# ifdef Q3SERVER
if ( svs . gametype = = GT_QUAKE3 )
{
2022-03-08 05:31:34 +00:00
if ( q3 - > sv . HandleClient ( & net_from , & net_message ) )
2020-02-26 00:37:52 +00:00
inboundsequence + + ;
else if ( NET_WasSpecialPacket ( svs . sockets ) )
return ;
return ;
}
# endif
// read the qport out of the message so we can fix up
// stupid address translating routers
2022-03-08 05:31:34 +00:00
MSG_BeginReading ( & net_message , svs . netprim ) ;
2020-02-26 00:37:52 +00:00
MSG_ReadLong ( ) ; // sequence number
MSG_ReadLong ( ) ; // sequence number
qport = MSG_ReadShort ( ) & 0xffff ;
// check for packets from connected clients
for ( i = 0 , cl = svs . clients ; i < svs . allocated_client_slots ; i + + , cl + + )
{
2023-09-11 09:31:09 +00:00
if ( cl - > state = = cs_free | | cl - > controller )
2020-02-26 00:37:52 +00:00
continue ;
if ( ! NET_CompareBaseAdr ( & net_from , & cl - > netchan . remote_address ) )
continue ;
# ifdef NQPROT
if ( ISNQCLIENT ( cl ) & & cl - > netchan . remote_address . port = = net_from . port )
{
if ( cl - > state > = cs_connected )
{
if ( cl - > delay > 0 )
goto dominping ;
2021-04-14 05:21:04 +00:00
switch ( NQNetChan_Process ( & cl - > netchan ) )
2020-02-26 00:37:52 +00:00
{
2021-04-14 05:21:04 +00:00
case NQNC_IGNORED :
break ;
case NQNC_ACK :
if ( cl - > netchan . message . cursize )
inboundsequence + + ; //we need to wake up...
if ( cl - > netchan . reliable_length > cl - > netchan . reliable_start )
inboundsequence + + ; //we need to wake up...
break ;
case NQNC_RELIABLE :
case NQNC_UNRELIABLE :
2020-02-26 00:37:52 +00:00
inboundsequence + + ;
svs . stats . packets + + ;
SVNQ_ExecuteClientMessage ( cl ) ;
2021-04-14 05:21:04 +00:00
break ;
2020-02-26 00:37:52 +00:00
}
}
break ;
}
# endif
# ifdef Q3SERVER
if ( ISQ3CLIENT ( cl ) )
continue ;
# endif
2023-08-19 02:14:09 +00:00
if ( cl - > netchan . qportsize = = 0 )
{ //no qports... use the actual port.
if ( cl - > netchan . remote_address . port ! = net_from . port )
continue ;
}
else
{
if ( cl - > netchan . qport ! = qport )
continue ;
}
2020-02-26 00:37:52 +00:00
if ( cl - > netchan . remote_address . port ! = net_from . port )
{
Con_DPrintf ( " SV_ReadPackets: fixing up a translated port \n " ) ;
cl - > netchan . remote_address . port = net_from . port ;
}
if ( cl - > delay > 0 )
{
# ifdef NQPROT
dominping :
# endif
if ( cl - > state < cs_connected )
break ;
if ( net_message . cursize > sizeof ( svs . free_lagged_packet - > data ) )
{
Con_Printf ( " packet too large for minping \n " ) ;
cl - > delay - = 0.001 ;
break ; //drop this packet
}
if ( ! svs . free_lagged_packet ) //kinda nasty
svs . free_lagged_packet = Z_Malloc ( sizeof ( * svs . free_lagged_packet ) ) ;
if ( ! cl - > laggedpacket )
cl - > laggedpacket_last = cl - > laggedpacket = svs . free_lagged_packet ;
else
{
cl - > laggedpacket_last - > next = svs . free_lagged_packet ;
cl - > laggedpacket_last = cl - > laggedpacket_last - > next ;
}
svs . free_lagged_packet = svs . free_lagged_packet - > next ;
cl - > laggedpacket_last - > next = NULL ;
cl - > laggedpacket_last - > time = realtime + cl - > delay ;
memcpy ( cl - > laggedpacket_last - > data , net_message . data , net_message . cursize ) ;
cl - > laggedpacket_last - > length = net_message . cursize ;
break ;
}
if ( Netchan_Process ( & cl - > netchan ) )
{ // this is a valid, sequenced packet, so process it
inboundsequence + + ;
svs . stats . packets + + ;
if ( cl - > state > = cs_connected )
{
if ( cl - > send_message )
cl - > chokecount + + ;
else
cl - > send_message = true ; // reply at end of frame
# ifdef Q2SERVER
2023-08-19 02:14:09 +00:00
if ( ISQ2CLIENT ( cl ) )
2020-02-26 00:37:52 +00:00
SVQ2_ExecuteClientMessage ( cl ) ;
else
# endif
SV_ExecuteClientMessage ( cl ) ;
}
}
break ;
}
if ( i ! = svs . allocated_client_slots )
return ;
# ifdef QWOVERQ3
2022-03-08 05:31:34 +00:00
if ( sv_listen_q3 . ival & & q3 - > sv . HandleClient ( ) )
2020-02-26 00:37:52 +00:00
{
received + + ;
continue ;
}
# endif
# ifdef NQPROT
if ( SVNQ_ConnectionlessPacket ( ) )
return ;
# endif
if ( SV_BannedReason ( & net_from ) )
return ;
if ( NET_WasSpecialPacket ( svs . sockets ) )
return ;
// packet is not from a known client
if ( sv_showconnectionlessmessages . ival )
2022-07-28 02:16:31 +00:00
Con_Printf ( S_COLOR_GRAY " %s:sequenced packet without connection (%i bytes) \n " , NET_AdrToString ( com_token , sizeof ( com_token ) , & net_from ) , net_message . cursize ) ; //hack: com_token cos we need some random temp buffer.
2020-02-26 00:37:52 +00:00
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = =
SV_ReadPackets
= = = = = = = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
void SV_KillExpiredBans ( void ) ;
2009-11-07 13:29:15 +00:00
# ifdef SERVER_DEMO_PLAYBACK
2004-08-23 00:15:46 +00:00
//FIMXE: move to header
qboolean SV_GetPacket ( void ) ;
2009-11-07 13:29:15 +00:00
# endif
2011-06-05 23:53:33 +00:00
qboolean SV_ReadPackets ( float * delay )
2004-08-23 00:15:46 +00:00
{
int i ;
client_t * cl ;
2007-08-30 20:45:01 +00:00
laggedpacket_t * lp ;
2020-02-26 00:37:52 +00:00
static int oldinboundsequence ;
2007-08-30 20:45:01 +00:00
2014-03-30 08:55:06 +00:00
SV_KillExpiredBans ( ) ;
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + ) //fixme: shouldn't we be using svs.allocated_client_slots ?
2007-08-30 20:45:01 +00:00
{
cl = & svs . clients [ i ] ;
2011-06-05 23:53:33 +00:00
while ( cl - > laggedpacket )
2007-08-30 20:45:01 +00:00
{
2011-06-05 23:53:33 +00:00
//schedule a wakeup so minping is more consistant
if ( cl - > laggedpacket - > time > realtime )
{
if ( * delay > cl - > laggedpacket - > time - realtime )
* delay = cl - > laggedpacket - > time - realtime ;
break ;
}
else
{
lp = cl - > laggedpacket ;
cl - > laggedpacket = lp - > next ;
if ( cl - > laggedpacket_last = = lp )
cl - > laggedpacket_last = lp - > next ;
2011-05-29 04:26:29 +00:00
2011-06-05 23:53:33 +00:00
lp - > next = svs . free_lagged_packet ;
svs . free_lagged_packet = lp ;
2007-08-30 20:45:01 +00:00
2011-06-05 23:53:33 +00:00
SZ_Clear ( & net_message ) ;
memcpy ( net_message . data , lp - > data , lp - > length ) ;
net_message . cursize = lp - > length ;
2011-05-29 04:26:29 +00:00
2011-06-05 23:53:33 +00:00
net_from = cl - > netchan . remote_address ; //not sure if anything depends on this, but lets not screw them up willynilly
2007-08-30 20:45:01 +00:00
2015-09-01 04:45:15 +00:00
# ifdef NQPROT
2012-02-12 05:18:31 +00:00
if ( ISNQCLIENT ( cl ) )
{
2014-03-30 08:55:06 +00:00
if ( cl - > state > = cs_connected )
2012-02-12 05:18:31 +00:00
{
if ( NQNetChan_Process ( & cl - > netchan ) )
{
2020-02-26 00:37:52 +00:00
inboundsequence + + ;
2012-02-12 05:18:31 +00:00
svs . stats . packets + + ;
SVNQ_ExecuteClientMessage ( cl ) ;
}
}
}
else
2015-09-01 04:45:15 +00:00
# endif
2012-02-12 05:18:31 +00:00
{
/*QW*/
if ( Netchan_Process ( & cl - > netchan ) )
{ // this is a valid, sequenced packet, so process it
2020-02-26 00:37:52 +00:00
inboundsequence + + ;
2012-02-12 05:18:31 +00:00
svs . stats . packets + + ;
2014-03-30 08:55:06 +00:00
if ( cl - > state > = cs_connected )
2012-02-12 05:18:31 +00:00
{ //make sure they didn't already disconnect
if ( cl - > send_message )
cl - > chokecount + + ;
else
cl - > send_message = true ; // reply at end of frame
# ifdef Q2SERVER
2023-08-19 02:14:09 +00:00
if ( ISQ2CLIENT ( cl ) )
2012-02-12 05:18:31 +00:00
SVQ2_ExecuteClientMessage ( cl ) ;
else
# endif
SV_ExecuteClientMessage ( cl ) ;
}
2011-06-05 23:53:33 +00:00
}
2007-08-30 20:45:01 +00:00
}
}
}
}
2004-08-23 00:15:46 +00:00
2020-02-26 00:37:52 +00:00
NET_ReadPackets ( svs . sockets ) ;
2009-11-04 21:16:50 +00:00
2020-02-26 00:37:52 +00:00
if ( inboundsequence = = oldinboundsequence )
return false ; //nothing new.
oldinboundsequence = inboundsequence ;
return true ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = = =
SV_CheckTimeouts
If a packet has not been received from a client in timeout . value
seconds , drop the conneciton .
When a client is normally dropped , the client_t goes into a zombie state
for a few seconds to make sure any final reliable message gets resent
if necessary
= = = = = = = = = = = = = = = = = =
*/
void SV_CheckTimeouts ( void )
{
int i ;
2015-06-14 12:26:01 +00:00
client_t * cl , * cont ;
2004-08-23 00:15:46 +00:00
float droptime ;
int nclients ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
droptime = realtime - timeout . value ;
nclients = 0 ;
2013-10-29 17:38:22 +00:00
for ( i = 0 , cl = svs . clients ; i < svs . allocated_client_slots ; i + + , cl + + )
2004-08-23 00:15:46 +00:00
{
2014-03-30 08:55:06 +00:00
if ( cl - > state = = cs_connected | | cl - > state = = cs_spawned )
{
2004-08-23 00:15:46 +00:00
if ( ! cl - > spectator )
nclients + + ;
2015-06-14 12:26:01 +00:00
cont = cl ;
if ( cont - > controller )
cont = cont - > controller ;
if ( cont - > netchan . last_received < droptime & & cl - > netchan . remote_address . type ! = NA_LOOPBACK & & cl - > protocol ! = SCP_BAD )
2013-11-29 14:36:47 +00:00
{
SV_BroadcastTPrintf ( PRINT_HIGH , " Client %s timed out \n " , cl - > name ) ;
2005-07-03 15:16:20 +00:00
SV_DropClient ( cl ) ;
2012-01-24 04:24:14 +00:00
cl - > state = cs_free ; // don't bother with zombie state for local player.
2022-07-28 02:18:05 +00:00
if ( cl - > netchan . remote_address . type ! = NA_INVALID )
NET_TerminateRoute ( svs . sockets , & cl - > netchan . remote_address ) ;
cl - > netchan . remote_address . type = NA_INVALID ;
2004-08-23 00:15:46 +00:00
}
}
2014-03-30 08:55:06 +00:00
if ( cl - > state = = cs_zombie & & realtime - cl - > connection_started > zombietime . value )
2022-07-28 02:18:05 +00:00
{
2004-08-23 00:15:46 +00:00
cl - > state = cs_free ; // can now be reused
2022-07-28 02:18:05 +00:00
if ( cl - > netchan . remote_address . type ! = NA_INVALID )
NET_TerminateRoute ( svs . sockets , & cl - > netchan . remote_address ) ;
cl - > netchan . remote_address . type = NA_INVALID ;
}
2014-03-30 08:55:06 +00:00
if ( cl - > state = = cs_loadzombie & & realtime - cl - > connection_started > zombietime . value )
{
2004-08-23 00:15:46 +00:00
if ( cl - > istobeloaded )
{
2016-07-12 00:40:13 +00:00
if ( 1 ) //svs.gametype != GT_PROGS)
2014-03-30 08:55:06 +00:00
{
2016-07-12 00:40:13 +00:00
cl - > netchan . remote_address . type = NA_INVALID ; //make it look like a bot.
if ( cl - > istobeloaded = = 1 )
cl - > state = cs_spawned ; //client has an entity, apparently.
else
cl - > state = cs_connected ; //not actually on yet
cl - > istobeloaded = false ;
2014-03-30 08:55:06 +00:00
if ( * cl - > name )
SV_BroadcastTPrintf ( PRINT_HIGH , " LoadZombie %s timed out \n " , cl - > name ) ;
else
2014-09-02 02:44:43 +00:00
SV_BroadcastTPrintf ( PRINT_HIGH , " LoadZombie timed out \n " ) ;
2016-07-12 00:40:13 +00:00
SV_DropClient ( cl ) ;
2014-03-30 08:55:06 +00:00
}
2016-07-12 00:40:13 +00:00
else
{
if ( cl - > istobeloaded = = 1 )
{
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , cl - > edict ) ;
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > ClientDisconnect ) ;
if ( * cl - > name )
SV_BroadcastTPrintf ( PRINT_HIGH , " LoadZombie %s timed out \n " , cl - > name ) ;
else
SV_BroadcastTPrintf ( PRINT_HIGH , " LoadZombie timed out \n " ) ;
}
sv . spawned_client_slots - - ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
cl - > istobeloaded = false ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
//must go through a zombie phase for 2 secs when the zombie gets removed.
cl - > state = cs_zombie ; // the real zombieness starts now
cl - > connection_started = realtime ;
}
2014-03-30 08:55:06 +00:00
}
else
{
//no entity, just free them.
2014-09-02 02:44:43 +00:00
# ifdef SUBSERVERS
SSV_SavePlayerStats ( cl , 3 ) ;
# endif
SV_BroadcastTPrintf ( PRINT_HIGH , " TransferZombie %s timed out \n " , cl - > name ) ;
2017-05-23 07:03:07 +00:00
cl - > state = cs_free ;
* cl - > name = 0 ;
2004-08-23 00:15:46 +00:00
}
2014-03-30 08:55:06 +00:00
cl - > netchan . remote_address . type = NA_INVALID ; //don't mess up from not knowing their address.
2004-08-23 00:15:46 +00:00
}
}
2016-08-25 00:12:14 +00:00
if ( ( sv . paused & PAUSE_EXPLICIT ) & & ! nclients )
2009-11-04 21:16:50 +00:00
{
2004-08-23 00:15:46 +00:00
// nobody left, unpause the server
2006-01-21 00:06:49 +00:00
if ( SV_TogglePause ( NULL ) )
2013-11-29 14:36:47 +00:00
SV_BroadcastTPrintf ( PRINT_HIGH , " pause released due to empty server \n " ) ;
2004-08-23 00:15:46 +00:00
}
}
/*
= = = = = = = = = = = = = = = = = = =
SV_GetConsoleCommands
Add them exactly as if they had been typed at the console
= = = = = = = = = = = = = = = = = = =
*/
2015-10-27 15:20:15 +00:00
qboolean QCExternalDebuggerCommand ( char * text ) ;
2004-08-23 00:15:46 +00:00
void SV_GetConsoleCommands ( void )
{
char * cmd ;
while ( 1 )
{
cmd = Sys_ConsoleInput ( ) ;
if ( ! cmd )
break ;
2015-10-27 15:20:15 +00:00
if ( QCExternalDebuggerCommand ( cmd ) )
continue ;
2014-02-07 08:38:40 +00:00
Log_String ( LOG_CONSOLE , cmd ) ;
2004-08-23 00:15:46 +00:00
Cbuf_AddText ( cmd , RESTRICT_LOCAL ) ;
2015-10-27 15:20:15 +00:00
Cbuf_AddText ( " \n " , RESTRICT_LOCAL ) ;
2004-08-23 00:15:46 +00:00
}
}
2016-10-22 07:06:51 +00:00
# define MINDRATE 4096
2011-10-27 16:16:29 +00:00
# define MINRATE 500
2004-10-19 16:10:14 +00:00
int SV_RateForClient ( client_t * cl )
{
int rate ;
2011-10-27 16:16:29 +00:00
if ( cl - > download )
2004-10-19 16:10:14 +00:00
{
rate = cl - > drate ;
2011-10-27 16:16:29 +00:00
if ( sv_maxdrate . ival )
{
if ( ! rate | | rate > sv_maxdrate . value )
rate = sv_maxdrate . value ;
else if ( rate < MINDRATE )
rate = MINDRATE ;
}
2016-10-22 07:06:51 +00:00
else if ( rate ! = 0 & & rate < MINDRATE )
2011-10-27 16:16:29 +00:00
rate = MINDRATE ;
2004-10-19 16:10:14 +00:00
}
else
{
rate = cl - > rate ;
2011-10-27 16:16:29 +00:00
if ( sv_maxrate . ival )
{
2016-07-12 00:40:13 +00:00
if ( ! rate | | rate > sv_maxrate . value )
2011-10-27 16:16:29 +00:00
rate = sv_maxrate . value ;
else if ( rate < MINRATE )
rate = MINRATE ;
}
2016-10-22 07:06:51 +00:00
else if ( rate ! = 0 & & rate < MINRATE )
2011-10-27 16:16:29 +00:00
rate = MINRATE ;
2004-10-19 16:10:14 +00:00
}
return rate ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = = =
SV_CheckVars
= = = = = = = = = = = = = = = = = = =
*/
void SV_CheckVars ( void )
{
static char * pw , * spw ;
int v ;
if ( password . string = = pw & & spectator_password . string = = spw )
return ;
pw = password . string ;
spw = spectator_password . string ;
v = 0 ;
if ( pw & & pw [ 0 ] & & strcmp ( pw , " none " ) )
v | = 1 ;
if ( spw & & spw [ 0 ] & & strcmp ( spw , " none " ) )
v | = 2 ;
Con_DPrintf ( " Updated needpass. \n " ) ;
if ( ! v )
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForKey ( & svs . info , " needpass " , " " ) ;
2004-08-23 00:15:46 +00:00
else
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForKey ( & svs . info , " needpass " , va ( " %i " , v ) ) ;
2004-08-23 00:15:46 +00:00
}
# ifdef Q2SERVER
void SVQ2_ClearEvents ( void )
{
q2edict_t * ent ;
int i ;
for ( i = 0 ; i < ge - > num_edicts ; i + + , ent + + )
{
ent = Q2EDICT_NUM ( i ) ;
// events only last for a single message
ent - > s . event = 0 ;
}
}
# endif
/*
= = = = = = = = = = = = = = = = = =
SV_Impulse_f
Spawns a client , uses an impulse , uses that clients think then removes the client .
= = = = = = = = = = = = = = = = = =
*/
void SV_Impulse_f ( void )
{
int i ;
2007-09-03 22:37:13 +00:00
if ( svs . gametype ! = GT_PROGS )
{
Con_Printf ( " Not supported in this game type \n " ) ;
return ;
}
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
{
if ( svs . clients [ i ] . state = = cs_free )
{
break ;
}
}
if ( i = = sv . allocated_client_slots )
{
Con_Printf ( " No empty player slots \n " ) ;
return ;
}
2005-03-18 06:13:11 +00:00
if ( ! svprogfuncs )
return ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
pr_global_struct - > time = sv . world . physicstime ;
2004-08-23 00:15:46 +00:00
2005-10-04 21:19:00 +00:00
svs . clients [ i ] . state = cs_connected ;
2023-01-26 07:07:53 +00:00
svs . clients [ i ] . connection_started = realtime ;
2005-10-04 21:19:00 +00:00
2005-10-07 16:27:40 +00:00
SV_SetUpClientEdict ( & svs . clients [ i ] , svs . clients [ i ] . edict ) ;
2004-10-03 22:52:02 +00:00
2017-10-12 12:02:25 +00:00
svprogfuncs - > SetStringField ( svprogfuncs , svs . clients [ i ] . edict , & svs . clients [ i ] . edict - > v - > netname , " Console " , true ) ;
2004-08-23 00:15:46 +00:00
2014-03-30 08:55:06 +00:00
sv . skipbprintclient = & svs . clients [ i ] ;
2004-08-23 00:15:46 +00:00
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , svs . clients [ i ] . edict ) ;
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > ClientConnect ) ;
2014-03-30 08:55:06 +00:00
sv . skipbprintclient = NULL ;
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
pr_global_struct - > time = sv . world . physicstime ;
2005-07-03 15:16:20 +00:00
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , svs . clients [ i ] . edict ) ;
2004-08-23 00:15:46 +00:00
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > PutClientInServer ) ;
2012-01-17 07:57:46 +00:00
sv . spawned_client_slots + + ;
2004-08-23 00:15:46 +00:00
2005-01-04 08:04:42 +00:00
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , svs . clients [ i ] . edict ) ;
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > PlayerPreThink ) ;
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , svs . clients [ i ] . edict ) ;
2005-03-28 00:11:59 +00:00
PR_ExecuteProgram ( svprogfuncs , svs . clients [ i ] . edict - > v - > think ) ;
2005-01-04 08:04:42 +00:00
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , svs . clients [ i ] . edict ) ;
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > PlayerPostThink ) ;
2005-03-28 00:11:59 +00:00
svs . clients [ i ] . edict - > v - > impulse = atoi ( Cmd_Argv ( 1 ) ) ;
2004-08-23 00:15:46 +00:00
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , svs . clients [ i ] . edict ) ;
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > PlayerPreThink ) ;
2004-10-03 22:52:02 +00:00
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , svs . clients [ i ] . edict ) ;
2005-03-28 00:11:59 +00:00
PR_ExecuteProgram ( svprogfuncs , svs . clients [ i ] . edict - > v - > think ) ;
2004-08-23 00:15:46 +00:00
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , svs . clients [ i ] . edict ) ;
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > PlayerPostThink ) ;
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , svs . clients [ i ] . edict ) ;
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > ClientDisconnect ) ;
2012-01-17 07:57:46 +00:00
sv . spawned_client_slots - - ;
2005-10-04 21:19:00 +00:00
svs . clients [ i ] . state = cs_free ;
2004-08-23 00:15:46 +00:00
}
2010-08-16 02:03:02 +00:00
static void SV_PauseChanged ( void )
{
int i ;
client_t * cl ;
// send notification to all clients
2013-10-29 17:38:22 +00:00
for ( i = 0 , cl = svs . clients ; i < svs . allocated_client_slots ; i + + , cl + + )
2010-08-16 02:03:02 +00:00
{
if ( ! cl - > state )
continue ;
if ( ( ISQWCLIENT ( cl ) | | ISNQCLIENT ( cl ) ) & & ! cl - > controller )
{
ClientReliableWrite_Begin ( cl , svc_setpause , 2 ) ;
ClientReliableWrite_Byte ( cl , sv . paused ! = 0 ) ;
}
}
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
2016-09-08 19:04:35 +00:00
if ( sv . mvdrecording )
{
ClientReliableWrite_Begin ( & demo . recorder , svc_setpause , 2 ) ;
ClientReliableWrite_Byte ( & demo . recorder , sv . paused ! = 0 ) ;
}
2018-09-01 04:18:08 +00:00
# endif
2010-08-16 02:03:02 +00:00
}
2022-07-28 02:17:45 +00:00
double server_frametime ;
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = =
SV_Frame
= = = = = = = = = = = = = = = = = =
*/
2011-06-05 23:53:33 +00:00
float SV_Frame ( void )
2004-08-23 00:15:46 +00:00
{
2005-07-01 19:23:00 +00:00
extern cvar_t pr_imitatemvdsv ;
2011-01-04 02:56:16 +00:00
static double start , end , idletime ;
2015-10-27 15:20:15 +00:00
static int oldpackets ;
2005-08-07 18:08:13 +00:00
float oldtime ;
2009-11-04 21:16:50 +00:00
qboolean isidle ;
2011-01-04 02:56:16 +00:00
float timedelta ;
2011-06-05 23:53:33 +00:00
float delay ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
start = Sys_DoubleTime ( ) ;
svs . stats . idle + = start - end ;
end = start ;
2011-04-20 03:34:32 +00:00
2015-10-27 15:20:15 +00:00
COM_MainThreadWork ( ) ;
2011-04-20 03:34:32 +00:00
//qw qc uses this for newmis handling
2006-12-26 18:19:35 +00:00
svs . framenum + + ;
2010-10-02 02:25:39 +00:00
if ( svs . framenum > 0x10000 )
svs . framenum = 0 ;
2005-07-03 15:16:20 +00:00
2011-06-05 23:53:33 +00:00
delay = sv_maxtic . value ;
2023-01-09 05:12:59 +00:00
if ( delay < sv_mintic . value )
delay = sv_mintic . value ;
2021-04-14 05:21:04 +00:00
if ( isDedicated & & sv . allocated_client_slots = = 0 )
2019-07-16 02:59:12 +00:00
delay = max ( delay , 1 ) ; //when idle, don't keep waking up for no reason
2011-06-05 23:53:33 +00:00
2004-08-23 00:15:46 +00:00
// keep the random time dependent
rand ( ) ;
2005-03-20 02:57:11 +00:00
if ( ! sv . gamespeed )
sv . gamespeed = 1 ;
2015-05-16 17:51:03 +00:00
# ifdef WEBCLIENT
if ( isDedicated )
{
// FTP_ClientThink();
2019-03-23 07:06:37 +00:00
HTTP_CL_Think ( NULL , NULL ) ;
2015-05-16 17:51:03 +00:00
}
# endif
2019-07-16 02:59:12 +00:00
# ifdef HAVE_CLIENT
2023-01-20 02:04:26 +00:00
isidle = ! isDedicated & & sv . allocated_client_slots = = 1 & & ( Key_Dest_Has ( ~ kdm_game )
# ifdef QUAKESTATS
| | IN_WeaponWheelIsShown ( )
# endif
| | cl . implicitpause ) & & cls . state = = ca_active ;
2016-12-09 09:09:12 +00:00
/*server is effectively paused in SP/coop if there are no clients/spectators*/
if ( sv . spawned_client_slots = = 0 & & sv . spawned_observer_slots = = 0 & & ! deathmatch . ival )
isidle = true ;
if ( ( sv . paused & PAUSE_AUTO ) ! = ( ( isidle ) ? PAUSE_AUTO : 0 ) )
2016-08-25 00:12:14 +00:00
sv . paused ^ = PAUSE_AUTO ;
2010-08-16 02:03:02 +00:00
# endif
2018-10-23 07:09:06 +00:00
if ( sv . oldpaused ! = sv . paused )
2010-08-16 02:03:02 +00:00
{
2018-10-23 07:09:06 +00:00
sv . oldpaused = sv . paused ;
2010-08-16 02:03:02 +00:00
SV_PauseChanged ( ) ;
}
2012-02-27 12:23:15 +00:00
//work out the gamespeed
if ( sv . gamespeed ! = sv_gamespeed . value )
{
char * newspeed ;
sv . gamespeed = sv_gamespeed . value ;
if ( sv . gamespeed < 0.1 | | sv . gamespeed = = 1 )
sv_gamespeed . value = sv . gamespeed = 1 ;
if ( sv . gamespeed = = 1 )
newspeed = " " ;
else
newspeed = va ( " %g " , sv . gamespeed * 100 ) ;
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForStarKey ( & svs . info , " *gamespeed " , newspeed ) ;
2012-02-27 12:23:15 +00:00
//correct sv.starttime
sv . starttime = Sys_DoubleTime ( ) - ( sv . time / sv . gamespeed ) ;
}
2004-08-23 00:15:46 +00:00
// decide the simulation time
2005-08-07 18:08:13 +00:00
{
oldtime = sv . time ;
sv . time = ( Sys_DoubleTime ( ) - sv . starttime ) * sv . gamespeed ;
2011-01-04 02:56:16 +00:00
timedelta = sv . time - oldtime ;
2005-08-07 18:08:13 +00:00
if ( sv . time < oldtime )
2011-01-04 02:56:16 +00:00
{
2005-08-07 18:08:13 +00:00
sv . time = oldtime ; //urm
2011-01-04 02:56:16 +00:00
timedelta = 0 ;
}
2005-08-07 18:08:13 +00:00
2012-01-17 07:57:46 +00:00
if ( isDedicated )
realtime + = sv . time - oldtime ;
2010-08-21 22:12:43 +00:00
if ( sv . paused & & sv . time > 1.5 )
2005-08-07 18:08:13 +00:00
{
2012-02-27 12:23:15 +00:00
sv . starttime + = ( sv . time - oldtime ) / sv . gamespeed ; //move the offset
2005-08-07 18:08:13 +00:00
sv . time = oldtime ; //and keep time as it was.
}
2004-08-23 00:15:46 +00:00
}
2005-08-07 18:08:13 +00:00
2010-03-14 14:35:56 +00:00
# ifdef WEBSERVER
2004-08-23 00:15:46 +00:00
IWebRun ( ) ;
# endif
2018-01-24 12:13:32 +00:00
# ifdef SV_MASTER
2009-11-04 21:16:50 +00:00
if ( sv_master . ival )
2023-03-15 17:57:31 +00:00
SVM_Think ( ) ;
2018-01-24 12:13:32 +00:00
# endif
2004-08-23 00:15:46 +00:00
2013-07-13 12:14:32 +00:00
# ifdef PLUGINS
if ( isDedicated )
Plug_Tick ( ) ;
# endif
2017-05-23 07:03:07 +00:00
# ifdef SUBSERVERS
MSV_PollSlaves ( ) ;
# endif
2019-07-02 04:12:20 +00:00
# ifdef SQL
SQL_ServerCycle ( ) ;
# endif
2009-11-04 21:16:50 +00:00
if ( sv . state < ss_active | | ! sv . world . worldmodel )
2004-08-23 00:15:46 +00:00
{
2014-03-30 08:55:06 +00:00
# ifdef SUBSERVERS
if ( sv . state = = ss_clustermode )
{
isidle = ! SV_ReadPackets ( & delay ) ;
SV_SendClientMessages ( ) ;
}
# endif
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
// check for commands typed to the host
if ( isDedicated )
# endif
{
SV_GetConsoleCommands ( ) ;
Cbuf_Execute ( ) ;
}
2011-06-05 23:53:33 +00:00
return delay ;
2004-08-23 00:15:46 +00:00
}
// check timeouts
SV_CheckTimeouts ( ) ;
SV_CheckTimer ( ) ;
// toggle the log buffer if full
SV_CheckLog ( ) ;
// get packets
2011-06-05 23:53:33 +00:00
isidle = ! SV_ReadPackets ( & delay ) ;
2020-02-11 18:06:10 +00:00
if ( isDedicated )
NET_Tick ( ) ;
2004-08-23 00:15:46 +00:00
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( pr_imitatemvdsv . ival | | dpcompat_nopreparse . ival )
2005-07-01 19:23:00 +00:00
{
Cbuf_Execute ( ) ;
if ( sv . state < ss_active ) //whoops...
2011-06-05 23:53:33 +00:00
return delay ;
2005-07-01 19:23:00 +00:00
}
2004-08-23 00:15:46 +00:00
if ( sv . multicast . cursize )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Unterminated multicast \n " ) ;
2004-08-23 00:15:46 +00:00
sv . multicast . cursize = 0 ;
}
// move autonomous things around if enough time has passed
2012-01-17 07:57:46 +00:00
if ( ! sv . paused | | ( sv . world . physicstime < 1 & & sv . spawned_client_slots ) )
2006-01-21 00:06:49 +00:00
{
2009-11-04 21:16:50 +00:00
# ifdef Q2SERVER
//q2 is idle even if clients sent packets.
if ( svs . gametype = = GT_QUAKE2 )
isidle = true ;
# endif
2004-08-23 00:15:46 +00:00
if ( SV_Physics ( ) )
2016-01-18 05:22:07 +00:00
{
2009-11-04 21:16:50 +00:00
isidle = false ;
2016-01-18 05:22:07 +00:00
2018-08-04 07:05:20 +00:00
# ifdef SAVEDGAMES
2016-01-18 05:22:07 +00:00
if ( sv . time > sv . autosave_time )
SV_AutoSave ( ) ;
2018-08-04 07:05:20 +00:00
# endif
2016-01-18 05:22:07 +00:00
}
2006-01-21 00:06:49 +00:00
}
else
{
2011-04-20 03:34:32 +00:00
isidle = idletime < 0.1 ;
2009-07-14 23:42:54 +00:00
# ifdef VM_Q1
if ( svs . gametype = = GT_Q1QVM )
{
Q1QVM_GameCodePausedTic ( Sys_DoubleTime ( ) - sv . pausedstart ) ;
}
else
# endif
{
PR_GameCodePausedTic ( Sys_DoubleTime ( ) - sv . pausedstart ) ;
}
2006-01-21 00:06:49 +00:00
}
2004-08-23 00:15:46 +00:00
2017-05-23 07:03:07 +00:00
//run any end-of-frame tasks that were set up
while ( svs . frameendtasks )
{
struct frameendtasks_s * t = svs . frameendtasks ;
svs . frameendtasks = t - > next ;
t - > callback ( t ) ;
Z_Free ( t ) ;
}
2011-04-20 03:34:32 +00:00
if ( ! isidle | | idletime > 0.15 )
2009-11-04 21:16:50 +00:00
{
2011-04-20 03:34:32 +00:00
//this is the q2 frame number found in the q2 protocol. each packet should contain a new frame or interpolation gets confused
sv . framenum + + ;
2009-11-04 21:16:50 +00:00
2009-11-07 13:29:15 +00:00
# ifdef SERVER_DEMO_PLAYBACK
2009-11-04 21:16:50 +00:00
while ( SV_ReadMVD ( ) ) ;
2009-11-07 13:29:15 +00:00
# endif
2004-08-23 00:15:46 +00:00
2009-11-04 21:16:50 +00:00
if ( sv . multicast . cursize )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Unterminated multicast \n " ) ;
2009-11-04 21:16:50 +00:00
sv . multicast . cursize = 0 ;
}
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
// check for commands typed to the host
2009-11-04 21:16:50 +00:00
if ( isDedicated )
2004-08-23 00:15:46 +00:00
# endif
2009-11-04 21:16:50 +00:00
{
2014-03-30 08:55:06 +00:00
if ( sv . framenum ! = 1 )
2015-01-07 13:34:05 +00:00
{
# ifndef SERVERONLY
Sys_SendKeyEvents ( ) ;
# else
2014-03-30 08:55:06 +00:00
SV_GetConsoleCommands ( ) ;
2015-01-07 13:34:05 +00:00
# endif
}
2004-08-23 00:15:46 +00:00
// process console commands
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( ! ( pr_imitatemvdsv . value | | dpcompat_nopreparse . ival ) )
2009-11-04 21:16:50 +00:00
Cbuf_Execute ( ) ;
}
2005-07-01 19:23:00 +00:00
2009-11-04 21:16:50 +00:00
if ( sv . state < ss_active ) //whoops...
2011-06-05 23:53:33 +00:00
return delay ;
2004-08-23 00:15:46 +00:00
2021-06-21 13:46:06 +00:00
//make sure the worldmodel is actually valid...
if ( sv . world . worldmodel & & sv . world . worldmodel - > loadstate ! = MLS_LOADED )
Mod_LoadModel ( sv . world . worldmodel , MLV_ERROR ) ;
2009-11-04 21:16:50 +00:00
SV_CheckVars ( ) ;
2004-08-23 00:15:46 +00:00
// send messages back to the clients that had packets read this frame
2009-11-04 21:16:50 +00:00
SV_SendClientMessages ( ) ;
2004-08-23 00:15:46 +00:00
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
2009-11-04 21:16:50 +00:00
SV_SendMVDMessage ( ) ;
2018-09-01 04:18:08 +00:00
# endif
2004-08-23 00:15:46 +00:00
// send a heartbeat to the master if needed
2014-12-23 15:26:42 +00:00
SV_Master_Heartbeat ( ) ;
2004-08-23 00:15:46 +00:00
# ifdef Q2SERVER
2009-11-04 21:16:50 +00:00
if ( ge & & ge - > edicts )
SVQ2_ClearEvents ( ) ;
2004-08-23 00:15:46 +00:00
# endif
2011-01-04 02:56:16 +00:00
idletime = 0 ;
2009-11-04 21:16:50 +00:00
}
2011-01-04 02:56:16 +00:00
idletime + = timedelta ;
2004-08-23 00:15:46 +00:00
// collect timing statistics
end = Sys_DoubleTime ( ) ;
svs . stats . active + = end - start ;
2015-10-27 15:20:15 +00:00
if ( svs . stats . maxresponse < end - start )
svs . stats . maxresponse = end - start ;
if ( svs . stats . maxpackets < svs . stats . packets - oldpackets )
svs . stats . maxpackets = svs . stats . packets - oldpackets ;
svs . stats . count + + ;
if ( svs . stats . latched_time < end )
2004-08-23 00:15:46 +00:00
{
svs . stats . latched_active = svs . stats . active ;
svs . stats . latched_idle = svs . stats . idle ;
svs . stats . latched_packets = svs . stats . packets ;
2015-10-27 15:20:15 +00:00
svs . stats . latched_count = svs . stats . count ;
svs . stats . latched_maxpackets = svs . stats . maxpackets ;
svs . stats . latched_maxresponse = svs . stats . maxresponse ;
svs . stats . latched_time = end + SVSTATS_PERIOD ;
2004-08-23 00:15:46 +00:00
svs . stats . active = 0 ;
svs . stats . idle = 0 ;
svs . stats . packets = 0 ;
svs . stats . count = 0 ;
2015-10-27 15:20:15 +00:00
svs . stats . maxresponse = 0 ;
svs . stats . maxpackets = 0 ;
2004-08-23 00:15:46 +00:00
}
2015-10-27 15:20:15 +00:00
oldpackets = svs . stats . packets ;
2022-07-28 02:17:45 +00:00
server_frametime + = end - start ;
2011-06-05 23:53:33 +00:00
return delay ;
2004-08-23 00:15:46 +00:00
}
2018-07-05 16:21:44 +00:00
static void SV_InfoChanged ( void * context , const char * key )
{
size_t i ;
2020-03-07 09:00:40 +00:00
# ifdef Q3SERVER
2022-03-08 05:31:34 +00:00
if ( q3 )
q3 - > sv . ServerinfoChanged ( key ) ;
2020-03-07 09:00:40 +00:00
# endif
2018-07-05 16:21:44 +00:00
if ( context ! = & svs . info & & * key = = ' _ ' )
return ; //these keys are considered private to originating client/server, and are not broadcast to anyone else
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
if ( sv . mvdrecording )
2018-07-05 16:21:44 +00:00
InfoSync_Add ( & demo . recorder . infosync , context , key ) ; //make sure it gets written into mvds too.
2018-09-01 04:18:08 +00:00
# endif
2018-07-05 16:21:44 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
{
2018-10-23 07:09:06 +00:00
if ( svs . clients [ i ] . state > = cs_connected & & ! svs . clients [ i ] . controller )
2018-07-05 16:21:44 +00:00
{
InfoSync_Add ( & svs . clients [ i ] . infosync , context , key ) ;
}
}
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = =
SV_InitLocal
= = = = = = = = = = = = = = =
*/
2005-10-05 02:16:28 +00:00
extern void Log_Init ( void ) ;
2004-08-23 00:15:46 +00:00
void SV_InitLocal ( void )
{
2013-04-13 08:15:18 +00:00
int i ;
2004-08-31 09:05:42 +00:00
extern cvar_t pr_allowbutton1 ;
2011-10-29 19:01:33 +00:00
extern cvar_t sv_aim ;
2004-08-23 00:15:46 +00:00
extern cvar_t pm_bunnyspeedcap ;
2023-01-25 23:14:13 +00:00
extern cvar_t pm_bunnyfriction ;
2004-08-23 00:15:46 +00:00
extern cvar_t pm_ktjump ;
extern cvar_t pm_slidefix ;
extern cvar_t pm_airstep ;
2019-03-01 22:39:30 +00:00
extern cvar_t pm_pground ;
2018-01-22 19:18:04 +00:00
extern cvar_t pm_stepdown ;
2005-01-04 08:04:42 +00:00
extern cvar_t pm_walljump ;
2005-05-17 02:36:54 +00:00
extern cvar_t pm_slidyslopes ;
2021-05-09 13:00:30 +00:00
extern cvar_t pm_autobunny ;
2014-04-06 15:16:39 +00:00
extern cvar_t pm_watersinkspeed ;
2014-06-21 17:58:17 +00:00
extern cvar_t pm_flyfriction ;
2018-12-11 00:20:59 +00:00
extern cvar_t pm_edgefriction ;
2004-08-23 00:15:46 +00:00
2021-08-04 21:17:38 +00:00
# ifdef VM_Q1 //cvars for pimping ourselves to ktx...
static cvar_t qws_name = CVARF ( " qws_name " , DISTRIBUTION , CVAR_NOSET ) ;
static cvar_t qws_fullname = CVARF ( " qws_fullname " , FULLENGINENAME , CVAR_NOSET ) ;
static cvar_t qws_version = CVARF ( " qws_version " , STRINGIFY ( FTE_VER_MAJOR ) " . " STRINGIFY ( FTE_VER_MINOR ) , CVAR_NOSET ) ;
static cvar_t qws_buildnum = CVARF ( " qws_buildnum " , STRINGIFY ( SVNREVISION ) , CVAR_NOSET ) ;
static cvar_t qws_platform = CVARF ( " qws_platform " , PLATFORM " - " ARCH_CPU_POSTFIX , CVAR_NOSET ) ;
static cvar_t qws_builddate = CVARF ( " qws_builddate " , STRINGIFY ( SVNDATE ) , CVAR_NOSET ) ;
static cvar_t qws_homepage = CVARF ( " qws_homepage " , " https://sourceforge.net/projects/fteqw/ " , CVAR_NOSET ) ;
Cvar_Register ( & qws_name , " Server Info " ) ;
Cvar_Register ( & qws_fullname , " Server Info " ) ;
Cvar_Register ( & qws_version , " Server Info " ) ;
Cvar_Register ( & qws_buildnum , " Server Info " ) ;
Cvar_Register ( & qws_platform , " Server Info " ) ;
Cvar_Register ( & qws_builddate , " Server Info " ) ;
Cvar_Register ( & qws_homepage , " Server Info " ) ;
# endif
2004-08-23 00:15:46 +00:00
SV_InitOperatorCommands ( ) ;
SV_UserInit ( ) ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
if ( isDedicated )
# endif
{
Cvar_Register ( & password , cvargroup_servercontrol ) ;
Cvar_Register ( & rcon_password , cvargroup_servercontrol ) ;
2005-10-05 02:16:28 +00:00
Log_Init ( ) ;
2004-08-23 00:15:46 +00:00
}
2005-07-03 15:16:20 +00:00
rcon_password . restriction = RESTRICT_MAX ; //no cheatie rconers changing rcon passwords...
2019-03-23 07:06:37 +00:00
Cvar_Register ( & sv_rconlim , cvargroup_servercontrol ) ;
2018-08-21 18:52:25 +00:00
Cvar_Register ( & sv_crypt_rcon , cvargroup_servercontrol ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & spectator_password , cvargroup_servercontrol ) ;
Cvar_Register ( & sv_mintic , cvargroup_servercontrol ) ;
Cvar_Register ( & sv_maxtic , cvargroup_servercontrol ) ;
2009-11-15 03:20:17 +00:00
Cvar_Register ( & sv_limittics , cvargroup_servercontrol ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & fraglimit , cvargroup_serverinfo ) ;
Cvar_Register ( & timelimit , cvargroup_serverinfo ) ;
Cvar_Register ( & teamplay , cvargroup_serverinfo ) ;
Cvar_Register ( & coop , cvargroup_serverinfo ) ;
Cvar_Register ( & skill , cvargroup_serverinfo ) ;
Cvar_Register ( & samelevel , cvargroup_serverinfo ) ;
Cvar_Register ( & maxclients , cvargroup_serverinfo ) ;
Cvar_Register ( & maxspectators , cvargroup_serverinfo ) ;
2013-06-23 02:17:02 +00:00
Cvar_Register ( & sv_playerslots , cvargroup_serverinfo ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & hostname , cvargroup_serverinfo ) ;
Cvar_Register ( & deathmatch , cvargroup_serverinfo ) ;
Cvar_Register ( & spawn , cvargroup_servercontrol ) ;
//arguably cheats. Must be switched on to use.
Cvar_Register ( & watervis , cvargroup_serverinfo ) ;
2005-07-03 15:16:20 +00:00
Cvar_Register ( & allow_skybox , cvargroup_serverinfo ) ;
Cvar_Register ( & sv_allow_splitscreen , cvargroup_serverinfo ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & fbskins , cvargroup_serverinfo ) ;
Cvar_Register ( & zombietime , cvargroup_servercontrol ) ;
2010-08-17 02:44:21 +00:00
Cvar_Register ( & sv_pupglow , cvargroup_serverinfo ) ;
2004-08-23 00:15:46 +00:00
2004-11-17 17:43:07 +00:00
Cvar_Register ( & sv_bigcoords , cvargroup_serverphysics ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & pm_bunnyspeedcap , cvargroup_serverphysics ) ;
2023-01-25 23:14:13 +00:00
Cvar_Register ( & pm_bunnyfriction , cvargroup_serverphysics ) ;
2014-04-06 15:16:39 +00:00
Cvar_Register ( & pm_watersinkspeed , cvargroup_serverphysics ) ;
2014-06-21 17:58:17 +00:00
Cvar_Register ( & pm_flyfriction , cvargroup_serverphysics ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & pm_ktjump , cvargroup_serverphysics ) ;
Cvar_Register ( & pm_slidefix , cvargroup_serverphysics ) ;
2005-05-17 02:36:54 +00:00
Cvar_Register ( & pm_slidyslopes , cvargroup_serverphysics ) ;
2021-05-09 13:00:30 +00:00
Cvar_Register ( & pm_autobunny , cvargroup_serverphysics ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & pm_airstep , cvargroup_serverphysics ) ;
2019-03-01 22:39:30 +00:00
Cvar_Register ( & pm_pground , cvargroup_serverphysics ) ;
2018-01-22 19:18:04 +00:00
Cvar_Register ( & pm_stepdown , cvargroup_serverphysics ) ;
2005-01-04 08:04:42 +00:00
Cvar_Register ( & pm_walljump , cvargroup_serverphysics ) ;
2018-12-11 00:20:59 +00:00
Cvar_Register ( & pm_edgefriction , cvargroup_serverphysics ) ;
2004-08-23 00:15:46 +00:00
2007-10-05 18:08:47 +00:00
Cvar_Register ( & sv_compatiblehulls , cvargroup_serverphysics ) ;
2012-11-27 03:23:19 +00:00
Cvar_Register ( & dpcompat_stats , " Darkplaces compatibility " ) ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < sizeof ( sv_motd ) / sizeof ( sv_motd [ 0 ] ) ; i + + )
Cvar_Register ( & sv_motd [ i ] , cvargroup_serverinfo ) ;
Cvar_Register ( & sv_aim , cvargroup_servercontrol ) ;
Cvar_Register ( & sv_resetparms , cvargroup_servercontrol ) ;
2018-07-22 11:49:37 +00:00
if ( isDedicated )
2020-01-01 07:46:41 +00:00
sv_public . enginevalue = " 1 " ;
2018-07-22 11:49:37 +00:00
2020-10-06 03:17:28 +00:00
Cvar_Register ( & sv_protocol , cvargroup_servercontrol ) ;
2017-09-26 04:26:08 +00:00
Cvar_Register ( & sv_guidhash , cvargroup_servercontrol ) ;
2014-03-30 08:55:06 +00:00
Cvar_Register ( & sv_serverip , cvargroup_servercontrol ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & sv_public , cvargroup_servercontrol ) ;
2020-02-11 18:06:10 +00:00
sv_public . restriction = RESTRICT_MAX ; //no disabling this over rcon.
2007-06-10 05:14:38 +00:00
Cvar_Register ( & sv_listen_qw , cvargroup_servercontrol ) ;
Cvar_Register ( & sv_listen_nq , cvargroup_servercontrol ) ;
Cvar_Register ( & sv_listen_dp , cvargroup_servercontrol ) ;
2017-05-18 10:24:09 +00:00
# ifdef QWOVERQ3
2008-11-09 22:29:28 +00:00
Cvar_Register ( & sv_listen_q3 , cvargroup_servercontrol ) ;
2017-05-18 10:24:09 +00:00
# endif
sv_listen_qw . restriction = RESTRICT_MAX ; //no disabling this over rcon.
2018-06-18 16:44:29 +00:00
Cvar_Register ( & sv_reconnectlimit , cvargroup_servercontrol ) ;
2019-07-16 02:59:12 +00:00
Cvar_Register ( & sv_use_dns , cvargroup_servercontrol ) ;
2014-04-24 01:53:01 +00:00
Cvar_Register ( & fraglog_public , cvargroup_servercontrol ) ;
2007-06-10 05:14:38 +00:00
2013-03-31 04:21:08 +00:00
SVNET_RegisterCvars ( ) ;
2006-05-09 00:02:05 +00:00
2005-06-09 16:29:32 +00:00
Cvar_Register ( & sv_reportheartbeats , cvargroup_servercontrol ) ;
2021-04-14 05:21:04 +00:00
Cvar_Register ( & sv_heartbeat_interval , cvargroup_servercontrol ) ;
Cvar_Register ( & sv_heartbeat_checks , cvargroup_servercontrol ) ;
2004-08-23 00:15:46 +00:00
2014-08-03 14:47:47 +00:00
Cvar_Register ( & sv_showconnectionlessmessages , cvargroup_servercontrol ) ;
Cvar_Register ( & sv_banproxies , cvargroup_serverpermissions ) ;
2018-01-24 12:13:32 +00:00
# ifdef SV_MASTER
2004-08-23 00:15:46 +00:00
Cvar_Register ( & sv_master , cvargroup_servercontrol ) ;
2018-01-24 12:13:32 +00:00
# endif
2004-08-23 00:15:46 +00:00
Cvar_Register ( & filterban , cvargroup_servercontrol ) ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
Cvar_Register ( & allow_download , cvargroup_serverpermissions ) ;
Cvar_Register ( & allow_download_skins , cvargroup_serverpermissions ) ;
Cvar_Register ( & allow_download_models , cvargroup_serverpermissions ) ;
Cvar_Register ( & allow_download_sounds , cvargroup_serverpermissions ) ;
2022-06-06 02:20:49 +00:00
Cvar_Register ( & allow_download_particles , cvargroup_serverpermissions ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & allow_download_maps , cvargroup_serverpermissions ) ;
2022-06-06 02:20:49 +00:00
Cvar_Register ( & allow_download_logs , cvargroup_serverpermissions ) ;
2004-08-30 05:34:41 +00:00
Cvar_Register ( & allow_download_demos , cvargroup_serverpermissions ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & allow_download_anymap , cvargroup_serverpermissions ) ;
2005-03-24 18:32:44 +00:00
Cvar_Register ( & allow_download_pakcontents , cvargroup_serverpermissions ) ;
2004-09-22 15:27:48 +00:00
Cvar_Register ( & allow_download_textures , cvargroup_serverpermissions ) ;
2005-12-21 03:07:33 +00:00
Cvar_Register ( & allow_download_configs , cvargroup_serverpermissions ) ;
2016-02-10 23:23:43 +00:00
Cvar_Register ( & allow_download_locs , cvargroup_serverpermissions ) ;
2011-10-27 16:16:29 +00:00
Cvar_Register ( & allow_download_packages , cvargroup_serverpermissions ) ;
2013-06-23 02:17:02 +00:00
Cvar_Register ( & allow_download_refpackages , cvargroup_serverpermissions ) ;
2004-09-22 15:27:48 +00:00
Cvar_Register ( & allow_download_wads , cvargroup_serverpermissions ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & allow_download_root , cvargroup_serverpermissions ) ;
2012-01-17 07:57:46 +00:00
Cvar_Register ( & allow_download_copyrighted , cvargroup_serverpermissions ) ;
2014-06-24 03:02:32 +00:00
Cvar_Register ( & allow_download_other , cvargroup_serverpermissions ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & secure , cvargroup_serverpermissions ) ;
Cvar_Register ( & sv_highchars , cvargroup_servercontrol ) ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
Cvar_Register ( & sv_calcphs , cvargroup_servercontrol ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & sv_phs , cvargroup_servercontrol ) ;
2007-08-30 18:55:44 +00:00
Cvar_Register ( & sv_cullplayers_trace , cvargroup_servercontrol ) ;
Cvar_Register ( & sv_cullentities_trace , cvargroup_servercontrol ) ;
2004-08-23 00:15:46 +00:00
2012-05-09 15:30:53 +00:00
Cvar_Register ( & sv_csqc_progname , cvargroup_servercontrol ) ;
2005-03-20 02:57:11 +00:00
Cvar_Register ( & sv_csqcdebug , cvargroup_servercontrol ) ;
2015-01-21 18:18:37 +00:00
Cvar_Register ( & sv_specprint , cvargroup_serverpermissions ) ;
2005-03-20 02:57:11 +00:00
2019-03-23 07:06:37 +00:00
Cvar_Register ( & sv_reliable_sound , cvargroup_serverphysics ) ;
2005-03-20 02:57:11 +00:00
Cvar_Register ( & sv_gamespeed , cvargroup_serverphysics ) ;
2013-03-12 22:53:23 +00:00
Cvar_Register ( & sv_nqplayerphysics , cvargroup_serverphysics ) ;
2004-08-31 09:05:42 +00:00
Cvar_Register ( & pr_allowbutton1 , cvargroup_servercontrol ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & pausable , cvargroup_servercontrol ) ;
Cvar_Register ( & sv_maxrate , cvargroup_servercontrol ) ;
2004-11-17 17:43:07 +00:00
Cvar_Register ( & sv_maxdrate , cvargroup_servercontrol ) ;
2019-03-01 22:39:30 +00:00
Cvar_ForceCallback ( & sv_maxrate ) ;
Cvar_ForceCallback ( & sv_maxdrate ) ;
2007-08-30 20:45:01 +00:00
Cvar_Register ( & sv_minping , cvargroup_servercontrol ) ;
2004-08-23 00:15:46 +00:00
Cvar_Register ( & sv_nailhack , cvargroup_servercontrol ) ;
2014-01-13 02:42:25 +00:00
Cvar_Register ( & sv_nopvs , cvargroup_servercontrol ) ;
2004-08-23 00:15:46 +00:00
Cmd_AddCommand ( " sv_impulse " , SV_Impulse_f ) ;
Cmd_AddCommand ( " openroute " , SV_OpenRoute_f ) ;
2018-08-04 07:05:20 +00:00
# ifdef SAVEDGAMES
# if !defined(NOBUILTINMENUS) && !defined(SERVERONLY)
2016-01-18 05:22:07 +00:00
Cvar_Register ( & sv_autosave , cvargroup_servercontrol ) ;
# endif
2018-05-21 13:47:53 +00:00
Cvar_Register ( & sv_savefmt , cvargroup_servercontrol ) ;
# ifndef QUAKETC
Cmd_AddCommandAD ( " savegame_legacy " , SV_Savegame_f , SV_Savegame_c , " Saves the game in a format compatible with vanilla Quake. Anything not supported by that format will be lost. " ) ;
# endif
2017-09-20 11:27:13 +00:00
Cmd_AddCommandAD ( " savegame " , SV_Savegame_f , SV_Savegame_c , " Saves the game to the named location. " ) ;
Cmd_AddCommandAD ( " loadgame " , SV_Loadgame_f , SV_Savegame_c , " Loads an existing saved game. " ) ;
Cmd_AddCommandAD ( " save " , SV_Savegame_f , SV_Savegame_c , " Saves the game to the named location. " ) ;
Cmd_AddCommandAD ( " load " , SV_Loadgame_f , SV_Savegame_c , " Loads an existing saved game. " ) ;
2020-04-19 01:23:32 +00:00
Cmd_AddCommandAD ( " unsavegame " , SV_DeleteSavegame_f , SV_Savegame_c , " Wipes an existing saved game from disk. " ) ;
2018-08-04 07:05:20 +00:00
# endif
2004-08-23 00:15:46 +00:00
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
2004-08-23 00:15:46 +00:00
SV_MVDInit ( ) ;
2018-09-01 04:18:08 +00:00
# endif
2004-08-23 00:15:46 +00:00
2018-07-05 16:21:44 +00:00
svs . info . ChangeCB = SV_InfoChanged ;
svs . info . ChangeCTX = & svs . info ;
InfoBuf_SetValueForStarKey ( & svs . info , " *version " , version_string ( ) ) ;
2019-03-01 22:53:51 +00:00
InfoBuf_SetValueForStarKey ( & svs . info , " *z_ext " , va ( " %i " , SERVER_SUPPORTED_Z_EXTENSIONS ) ) ;
2004-08-23 00:15:46 +00:00
// init fraglog stuff
svs . logsequence = 1 ;
svs . logtime = realtime ;
2014-07-12 03:59:04 +00:00
for ( i = 0 ; i < FRAGLOG_BUFFERS ; i + + )
{
svs . log [ i ] . data = svs . log_buf [ i ] ;
svs . log [ i ] . maxsize = sizeof ( svs . log_buf [ i ] ) ;
svs . log [ i ] . cursize = 0 ;
svs . log [ i ] . allowoverflow = true ;
}
2006-05-13 21:11:06 +00:00
2012-02-12 05:18:31 +00:00
svs . free_lagged_packet = NULL ;
2004-08-23 00:15:46 +00:00
}
2012-09-30 05:52:03 +00:00
# define iswhite(c) ((c) == ' ' || (unsigned char)(c) == (unsigned char)INVIS_CHAR1 || (unsigned char)(c) == (unsigned char)INVIS_CHAR2 || (unsigned char)(c) == (unsigned char)INVIS_CHAR3)
2021-08-23 06:37:21 +00:00
# define isinvalid(c) ((c) == ':' || (c) == '\\' || (c) == '$' || (c) == '\r' || (c) == '\n' || (unsigned char)(c) == (unsigned char)0xff || (c) == '\"')
//colon is so clients can't get confused while parsing chats (eg frag messages)
//255 is so fuhquake/ezquake don't end up with nameless players (and general MSG_ReadString bugs)
2015-01-21 18:18:37 +00:00
//" is so mods that use player names in tokenizing/frik_files don't mess up. mods are still expected to be able to cope with space.
2018-07-05 16:21:44 +00:00
//\ is blocked because it messes up our ^[NAME\player\NUM^] links, and because vanilla would hate it.
2021-08-23 06:37:21 +00:00
//$ is blocked because of potential internationalisation escapes.
2009-05-24 10:11:17 +00:00
2004-08-23 00:15:46 +00:00
//is allowed to shorten, out must be as long as in and min of "unnamed"+1
2018-03-25 09:36:14 +00:00
void SV_FixupName ( const char * in , char * out , unsigned int outlen )
2004-08-23 00:15:46 +00:00
{
char * s , * p ;
2018-07-05 16:21:44 +00:00
unsigned int len , codepoint , codeflags ;
conchar_t testbuf [ 1024 ] , * t , * n , * e ;
2008-08-23 19:17:19 +00:00
if ( outlen = = 0 )
return ;
len = outlen ;
2004-08-23 00:15:46 +00:00
s = out ;
2009-05-24 10:11:17 +00:00
while ( iswhite ( * in ) | | isinvalid ( * in ) | | * in = = ' \1 ' | | * in = = ' \2 ' ) //1 and 2 are to stop clients from printing the entire line as chat. only do that for the leading charater.
2004-08-23 00:15:46 +00:00
in + + ;
2017-11-14 14:37:04 +00:00
while ( * in & & len > 1 )
2004-08-23 00:15:46 +00:00
{
if ( isinvalid ( * in ) )
2018-07-05 16:21:44 +00:00
{ //chars that cause a problem.
2004-08-23 00:15:46 +00:00
in + + ;
continue ;
}
* s + + = * in + + ;
2008-08-23 19:17:19 +00:00
len - - ;
2004-08-23 00:15:46 +00:00
}
* s = ' \0 ' ;
2012-10-13 00:56:31 +00:00
/*note: clients are not guarenteed to parse things the same as the server. utf-8 surrogates may be awkward here*/
e = COM_ParseFunString ( CON_WHITEMASK , out , testbuf , sizeof ( testbuf ) , false ) ;
2018-07-05 16:21:44 +00:00
for ( t = testbuf ; t < e ; t = n )
2012-10-13 00:56:31 +00:00
{
2018-07-05 16:21:44 +00:00
n = Font_Decode ( t , & codeflags , & codepoint ) ;
2012-10-13 00:56:31 +00:00
/*reject anything hidden in names*/
2018-07-05 16:21:44 +00:00
if ( ( codeflags & CON_HIDDEN ) | | ( codeflags & ( CON_LINKSPECIAL | CON_RICHFORECOLOUR ) ) = = CON_LINKSPECIAL )
2012-10-13 00:56:31 +00:00
break ;
/*reject pictograms*/
2018-07-05 16:21:44 +00:00
if ( codepoint > = 0xe100 & & codepoint < 0xe200 )
break ;
if ( ! sv_highchars . ival & & ( codeflags & CON_2NDCHARSETTEXT ) )
2012-10-13 00:56:31 +00:00
break ;
/*FIXME: should we try to ensure that the chars are in most fonts? that might annoy speakers of more exotic languages I suppose. cvar it?*/
}
2018-07-05 16:21:44 +00:00
//and spit it out again, which makes sure there's no weird markup that might screw up other strings.
COM_DeFunString ( testbuf , t , out , outlen , false , false ) ;
2012-10-13 00:56:31 +00:00
if ( ! * out | | ( t < e ) | | e = = testbuf )
2007-06-20 00:02:54 +00:00
{ //reached end and it was all whitespace
2004-08-23 00:15:46 +00:00
//white space only
2008-08-23 19:17:19 +00:00
strncpy ( out , " unnamed " , outlen ) ;
out [ outlen - 1 ] = 0 ;
2004-08-23 00:15:46 +00:00
p = out ;
}
for ( p = out + strlen ( out ) - 1 ; p ! = out & & iswhite ( * p ) ; p - - )
;
p [ 1 ] = 0 ;
}
2020-09-08 05:11:09 +00:00
void SV_DeDupeName ( const char * val , client_t * cl , char * newname , size_t newnamesize )
{
int i ;
client_t * client ;
int dupc = 1 ;
char basic [ 80 ] ;
const char * p ;
if ( ! val )
val = " " ;
//we block large names here because a) they're unwieldly. b) they might cause players to be invisible to older clients/server browsers/etc.
//bots with no name skip the fixup, to avoid default names(they're expected to be given a name eventually, so are allowed to be invisible for now)
if ( cl & & cl - > protocol = = SCP_BAD & & ! * val )
newname [ 0 ] = 0 ;
else
{
SV_FixupName ( val , newname , newnamesize ) ;
if ( strlen ( newname ) > 40 )
newname [ 40 ] = 0 ;
}
//strip weirdness
deleetstring ( basic , newname ) ;
if ( ! cl | | cl - > protocol ! = SCP_BAD )
{ //don't bother validating bot names. The gamecode is expected to not be stupid.
if ( ! basic [ 0 ] | | strstr ( basic , " console " ) )
strcpy ( newname , " unnamed " ) ;
// check to see if another user by the same name exists
while ( 1 )
{
for ( i = 0 , client = svs . clients ; i < svs . allocated_client_slots ; i + + , client + + )
{
if ( client - > state < cs_connected | | client = = cl )
continue ;
if ( ! stricmp ( client - > name , newname ) )
break ;
}
if ( i ! = svs . allocated_client_slots )
{ // dup name
char tmpname [ 80 ] ;
if ( strlen ( newname ) > sizeof ( cl - > namebuf ) - 1 )
newname [ sizeof ( cl - > namebuf ) - 4 ] = 0 ;
p = newname ;
if ( newname [ 0 ] = = ' ( ' )
{
2021-06-23 02:14:18 +00:00
if ( newname [ 1 ] > = ' 0 ' & & newname [ 1 ] < = ' 9 ' )
{
if ( newname [ 2 ] = = ' ) ' )
p = newname + 3 ;
else if ( newname [ 2 ] > = ' 0 ' & & newname [ 2 ] < = ' 9 ' )
{
if ( newname [ 3 ] = = ' ) ' )
p = newname + 4 ;
else if ( newname [ 3 ] > = ' 0 ' & & newname [ 3 ] < = ' 9 ' )
{
if ( newname [ 4 ] = = ' ) ' )
p = newname + 5 ;
}
}
}
2020-09-08 05:11:09 +00:00
}
memcpy ( tmpname , p , strlen ( p ) + 1 ) ;
Q_snprintfz ( newname , newnamesize , " (%d)%-.40s " , dupc + + , tmpname ) ;
}
else
break ;
}
}
}
2004-08-23 00:15:46 +00:00
2014-03-30 08:55:06 +00:00
qboolean ReloadRanking ( client_t * cl , const char * newname )
2004-08-23 00:15:46 +00:00
{
2005-11-03 23:40:51 +00:00
# ifdef SVRANKING
2004-08-23 00:15:46 +00:00
int newid ;
int j ;
rankstats_t rs ;
2018-07-05 16:21:44 +00:00
newid = Rank_GetPlayerID ( cl - > guid , newname , atoi ( InfoBuf_ValueForKey ( & cl - > userinfo , " _pwd " ) ) , true , false ) ; //'_' keys are always stripped. On any server. So try and use that so persistant data won't give out the password when connecting to a different server
2004-08-23 00:15:46 +00:00
if ( ! newid )
2018-07-05 16:21:44 +00:00
newid = Rank_GetPlayerID ( cl - > guid , newname , atoi ( InfoBuf_ValueForKey ( & cl - > userinfo , " password " ) ) , true , false ) ;
2004-08-23 00:15:46 +00:00
if ( newid )
{
if ( cl - > rankid & & cl - > state > = cs_spawned ) //apply current stats
{
if ( ! Rank_GetPlayerStats ( cl - > rankid , & rs ) )
return false ;
rs . timeonserver + = realtime - cl - > stats_started ;
cl - > stats_started = realtime ;
rs . kills + = cl - > kills ;
rs . deaths + = cl - > deaths ;
rs . flags1 & = ~ ( RANK_CUFFED | RANK_MUTED | RANK_CRIPPLED ) ;
2014-06-25 03:53:11 +00:00
// if (cl->iscuffed==2)
// rs.flags1 |= RANK_CUFFED;
// if (cl->ismuted==2)
// rs.flags1 |= RANK_MUTED;
// if (cl->iscrippled==2)
// rs.flags1 |= RANK_CRIPPLED;
2004-08-23 00:15:46 +00:00
cl - > kills = 0 ;
cl - > deaths = 0 ;
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , cl - > edict ) ;
2011-10-27 16:16:29 +00:00
if ( pr_global_ptrs - > SetChangeParms )
2004-08-23 00:15:46 +00:00
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > SetChangeParms ) ;
2009-11-05 03:07:52 +00:00
for ( j = 0 ; j < NUM_RANK_SPAWN_PARMS ; j + + )
2011-10-27 16:16:29 +00:00
if ( pr_global_ptrs - > spawnparamglobals [ j ] )
rs . parm [ j ] = * pr_global_ptrs - > spawnparamglobals [ j ] ;
2004-08-23 00:15:46 +00:00
Rank_SetPlayerStats ( cl - > rankid , & rs ) ;
2011-09-03 03:49:43 +00:00
cl - > rankid = 0 ;
2004-08-23 00:15:46 +00:00
}
if ( ! Rank_GetPlayerStats ( newid , & rs ) )
return false ;
cl - > rankid = newid ;
if ( rs . flags1 & RANK_CUFFED )
2014-06-25 03:53:11 +00:00
cl - > penalties | = BAN_CUFF ;
2004-08-23 00:15:46 +00:00
if ( rs . flags1 & RANK_MUTED )
2014-06-25 03:53:11 +00:00
cl - > penalties | = BAN_MUTE ;
2004-08-23 00:15:46 +00:00
if ( rs . flags1 & RANK_CRIPPLED )
2014-06-25 03:53:11 +00:00
cl - > penalties | = BAN_CRIPPLED ;
2004-08-23 00:15:46 +00:00
cl - > trustlevel = rs . trustlevel ;
return true ;
}
2005-11-03 23:40:51 +00:00
# endif
2004-08-23 00:15:46 +00:00
return false ;
}
/*
= = = = = = = = = = = = = = = = =
SV_ExtractFromUserinfo
Pull specific info from a newly changed userinfo string
into a more C freindly form .
= = = = = = = = = = = = = = = = =
*/
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
void SV_ExtractFromUserinfo ( client_t * cl , qboolean verbose )
2004-08-23 00:15:46 +00:00
{
2019-03-12 05:04:27 +00:00
const char * val , * p ;
2020-09-08 05:11:09 +00:00
char newname [ 80 ] ;
2016-10-22 07:06:51 +00:00
# ifdef SVRANKING
2012-01-24 04:24:14 +00:00
extern cvar_t rank_filename ;
2016-10-22 07:06:51 +00:00
# endif
2019-03-12 05:04:27 +00:00
size_t blobsize ;
qboolean large ;
2004-08-23 00:15:46 +00:00
2018-07-05 16:21:44 +00:00
int bottom = atoi ( InfoBuf_ValueForKey ( & cl - > userinfo , " bottomcolor " ) ) ;
2015-04-14 23:12:17 +00:00
if ( progstype = = PROG_NQ )
p = va ( " t%u " , bottom ) ;
else
2018-07-05 16:21:44 +00:00
p = InfoBuf_ValueForKey ( & svs . localinfo , va ( " team%u " , bottom ) ) ;
val = InfoBuf_ValueForKey ( & cl - > userinfo , " team " ) ;
2015-04-14 23:12:17 +00:00
if ( * p & & strcmp ( p , val ) )
{
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForKey ( & cl - > userinfo , " team " , p ) ;
2015-04-14 23:12:17 +00:00
if ( verbose )
dpp7: Treat 'dropped' c2s packets as choked when using dpp7 protocols. This is because the protocol provides no way to disambiguate, and I don't like false reports of packetloss (only reliables loss can be detected, and that's not frequent enough to be meaningful). Pings can still be determined with dpp7, for those few packets which are acked.
package manager: reworked to enable/disable plugins when downloaded, which can also be present-but-disabled.
package manager: display a confirmation prompt before applying changes. do not allow other changes to be made while applying. prompt may be skipped with 'pkg apply' in dedicated servers.
sv: downloads are no longer forced to lower case.
sv: added sv_demoAutoCompress cvar. set to 1 to directly record to *.mvd.gz
cl: properly support directly playing .mvd.gz files
menus: reworked to separate mouse and keyboard focus. mouse focus becomes keyboard focus only on mouse clicks. tooltips follow mouse cursors.
menus: cleaned up menu heirachy a little. now simpler.
server browser: changed 'hide *' filters to 'show *' instead. I felt it was more logical.
deluxmapping: changed to disabled, load, generate, like r_loadlit is.
render targets api now supports negative formats to mean nearest filtering, where filtering is part of texture state.
drawrotpic fixed, now batches and interacts with drawpic correctly.
drawline fixed, no interacts with draw* correctly, but still does not batch.
fixed saving games.
provide proper userinfo to nq clients, where supported.
qcc: catch string table overflows safely, giving errors instead of crashes. switch to 32bit statements if some over-sized function requires it.
qtv: some bigcoords support tweaks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5073 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-03-21 05:27:07 +00:00
SV_BroadcastUserinfoChange ( cl , true , " team " , p ) ;
2015-04-14 23:12:17 +00:00
}
2005-05-17 02:36:54 +00:00
Q_strncpyz ( cl - > team , val , sizeof ( cl - > teambuf ) ) ;
2004-08-23 00:15:46 +00:00
// name for C code
2019-03-12 05:04:27 +00:00
val = InfoBuf_BlobForKey ( & cl - > userinfo , " name " , & blobsize , & large ) ;
2020-09-08 05:11:09 +00:00
if ( large ) //don't allow it if there's even anything weird in there (simplies the necessary qc).
2019-03-12 05:04:27 +00:00
val = " " ;
2020-09-08 05:11:09 +00:00
//fixup and dedupe
SV_DeDupeName ( val , cl , newname , sizeof ( newname ) ) ;
2005-07-03 15:16:20 +00:00
2016-10-22 07:06:51 +00:00
if ( ! cl - > drop & & strncmp ( newname , cl - > name , sizeof ( cl - > namebuf ) - 1 ) )
2005-07-03 15:16:20 +00:00
{
2014-06-25 03:53:11 +00:00
if ( ( cl - > penalties & BAN_MUTE ) & & * cl - > name & & verbose ) //!verbose is a gamecode-forced update, where the gamecode is expected to know what its doing.
2015-09-01 04:45:15 +00:00
{
if ( ! ( cl - > penalties & BAN_STEALTH ) )
SV_ClientTPrintf ( cl , PRINT_HIGH , " Muted players may not change their names \n " ) ;
2016-07-12 00:40:13 +00:00
Q_strncpyz ( newname , cl - > name , sizeof ( newname ) ) ;
2015-09-01 04:45:15 +00:00
}
2016-07-12 00:40:13 +00:00
if ( ! sv . paused & & * cl - > name )
2004-08-23 00:15:46 +00:00
{
2016-07-12 00:40:13 +00:00
if ( ! cl - > lastnametime | | realtime - cl - > lastnametime > 5 )
{
cl - > lastnamecount = 0 ;
cl - > lastnametime = realtime ;
}
else if ( cl - > lastnamecount + + > 4 & & verbose )
{
SV_AutoAddPenalty ( cl , BAN_MUTE , 60 * 5 , " Muted for name spam " ) ;
Q_strncpyz ( newname , cl - > name , sizeof ( newname ) ) ;
}
}
2004-08-23 00:15:46 +00:00
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( ! cl - > drop & & strncmp ( newname , cl - > name , sizeof ( cl - > namebuf ) - 1 ) & & cl - > state > cs_zombie )
2016-07-12 00:40:13 +00:00
{
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
if ( * cl - > name & & cl - > state > = cs_spawned & & ! cl - > spectator & & verbose )
2005-07-03 15:16:20 +00:00
{
2013-11-29 14:36:47 +00:00
SV_BroadcastTPrintf ( PRINT_HIGH , " %s changed their name to %s \n " , cl - > name , newname ) ;
2004-08-23 00:15:46 +00:00
}
2005-05-17 02:36:54 +00:00
Q_strncpyz ( cl - > name , newname , sizeof ( cl - > namebuf ) ) ;
2004-08-23 00:15:46 +00:00
2014-03-30 08:55:06 +00:00
if ( svprogfuncs )
svprogfuncs - > SetStringField ( svprogfuncs , cl - > edict , & cl - > edict - > v - > netname , cl - > name , true ) ;
2004-08-23 00:15:46 +00:00
# ifdef SVRANKING
if ( ReloadRanking ( cl , newname ) )
{
}
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
else if ( cl - > state > = cs_spawned & & * rank_filename . string & & verbose )
2013-11-29 14:36:47 +00:00
SV_ClientTPrintf ( cl , PRINT_HIGH , " Your rankings name has not been changed \n " ) ;
2004-08-23 00:15:46 +00:00
# endif
}
}
2018-07-05 16:21:44 +00:00
//make CERTAIN that the name we think they're using is actually the name everyone else sees too.
2018-09-23 19:35:24 +00:00
//bots are allowed empty names. this gives the gamecode a chance to actually assign one.
if ( cl - > protocol ! = SCP_BAD )
2018-07-05 16:21:44 +00:00
{
InfoBuf_SetValueForKey ( & cl - > userinfo , " name " , newname ) ;
val = InfoBuf_ValueForKey ( & cl - > userinfo , " name " ) ;
if ( ! * val )
{
SV_BroadcastTPrintf ( PRINT_HIGH , " corrupt userinfo for player %s \n " , cl - > name ) ;
cl - > drop = true ;
}
}
val = InfoBuf_ValueForKey ( & cl - > userinfo , " lang " ) ;
2018-12-28 00:04:36 +00:00
cl - > language = * val ? TL_FindLanguage ( val ) : com_language ;
2004-08-23 00:15:46 +00:00
2018-07-05 16:21:44 +00:00
val = InfoBuf_ValueForKey ( & cl - > userinfo , " nogib " ) ;
2013-11-29 14:36:47 +00:00
cl - > gibfilter = ! ! atoi ( val ) ;
2004-08-23 00:15:46 +00:00
// rate command
2018-07-05 16:21:44 +00:00
val = InfoBuf_ValueForKey ( & cl - > userinfo , " rate " ) ;
2004-08-23 00:15:46 +00:00
if ( strlen ( val ) )
2004-10-19 16:10:14 +00:00
cl - > rate = atoi ( val ) ;
else
2016-07-12 00:40:13 +00:00
cl - > rate = 0 ; //0 means no specific limit, limited only by sv_maxrate.
2004-10-19 16:10:14 +00:00
2018-07-05 16:21:44 +00:00
val = InfoBuf_ValueForKey ( & cl - > userinfo , " dupe " ) ;
2015-10-11 11:34:58 +00:00
cl - > netchan . dupe = bound ( 0 , atoi ( val ) , 5 ) ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
2018-07-05 16:21:44 +00:00
val = InfoBuf_ValueForKey ( & cl - > userinfo , " drate " ) ;
2004-10-19 16:10:14 +00:00
if ( strlen ( val ) )
cl - > drate = atoi ( val ) ;
else
2016-10-22 07:06:51 +00:00
cl - > drate = 0 ; //0 disables rate limiting while downloading
2004-08-23 00:15:46 +00:00
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
2018-07-05 16:21:44 +00:00
val = InfoBuf_ValueForKey ( & cl - > userinfo , " cl_playerclass " ) ;
2006-03-23 19:22:12 +00:00
if ( val )
{
2010-05-01 22:47:47 +00:00
PRH2_SetPlayerClass ( cl , atoi ( val ) , false ) ;
2006-03-23 19:22:12 +00:00
}
2014-09-17 03:04:08 +00:00
# endif
2006-03-23 19:22:12 +00:00
2019-12-10 14:50:47 +00:00
val = InfoBuf_ValueForKey ( & cl - > userinfo , " noaim " ) ;
if ( atoi ( val ) > 0 )
cl - > autoaimdot = 2 ; //disable, ignoring sv_aim
else
{
val = InfoBuf_ValueForKey ( & cl - > userinfo , " aim " ) ;
if ( * val )
{
cl - > autoaimdot = atof ( val ) ;
if ( cl - > autoaimdot > 1 )
cl - > autoaimdot = cos ( cl - > autoaimdot * M_PI / 180 ) ; //interpret it as an accepted angle in degrees
}
else
cl - > autoaimdot = sv_aim . value ;
}
2004-08-23 00:15:46 +00:00
// msg command
2018-07-05 16:21:44 +00:00
val = InfoBuf_ValueForKey ( & cl - > userinfo , " msg " ) ;
2004-08-23 00:15:46 +00:00
if ( strlen ( val ) )
{
cl - > messagelevel = atoi ( val ) ;
}
2014-03-30 08:55:06 +00:00
2018-07-05 16:21:44 +00:00
val = InfoBuf_ValueForKey ( & cl - > userinfo , " sp " ) ; //naming for compat with mvdsv
2015-01-21 18:18:37 +00:00
if ( * val )
cl - > spec_print = atoi ( val ) ;
else
cl - > spec_print = ~ 0 ; //if unspecified, default to server setting (even if the cvar is changed mid-map).
2004-08-23 00:15:46 +00:00
# ifdef NQPROT
{
2018-07-05 16:21:44 +00:00
int top = atoi ( InfoBuf_ValueForKey ( & cl - > userinfo , " topcolor " ) ) ;
2005-09-08 22:52:46 +00:00
top & = 15 ;
if ( top > 13 )
top = 13 ;
bottom & = 15 ;
if ( bottom > 13 )
bottom = 13 ;
2016-07-12 00:40:13 +00:00
if ( cl - > playercolor ! = top * 16 + bottom )
2005-09-08 22:52:46 +00:00
{
2016-07-12 00:40:13 +00:00
cl - > playercolor = top * 16 + bottom ;
if ( svs . gametype = = GT_PROGS | | svs . gametype = = GT_Q1QVM )
{
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
2016-07-12 00:40:13 +00:00
if ( cl - > edict )
cl - > edict - > xv - > clientcolors = cl - > playercolor ;
2018-10-23 07:09:06 +00:00
# endif
2016-07-12 00:40:13 +00:00
MSG_WriteByte ( & sv . nqreliable_datagram , svc_updatecolors ) ;
MSG_WriteByte ( & sv . nqreliable_datagram , cl - svs . clients ) ;
MSG_WriteByte ( & sv . nqreliable_datagram , cl - > playercolor ) ;
}
2005-09-08 22:52:46 +00:00
}
2004-08-23 00:15:46 +00:00
}
# endif
}
//============================================================================
/*
= = = = = = = = = = = = = = = = = = = =
SV_InitNet
= = = = = = = = = = = = = = = = = = = =
*/
void SV_InitNet ( void )
{
# ifndef SERVERONLY
if ( isDedicated )
# endif
{
Netchan_Init ( ) ;
}
2014-12-23 15:26:42 +00:00
SV_Master_ReResolve ( ) ;
2005-05-26 12:55:34 +00:00
2004-08-23 00:15:46 +00:00
// NET_StringToAdr ("192.246.40.70:27000", &idmaster_adr);
}
/*
= = = = = = = = = = = = = = = = = = = =
SV_Init
= = = = = = = = = = = = = = = = = = = =
*/
2009-11-07 13:29:15 +00:00
# ifdef SERVER_DEMO_PLAYBACK
2004-08-23 00:15:46 +00:00
//FIXME: move to header
void SV_Demo_Init ( void ) ;
2009-11-07 13:29:15 +00:00
# endif
2016-01-18 05:22:07 +00:00
void SV_ArgumentOverrides ( void )
{
int p ;
// parse params for cvars
p = COM_CheckParm ( " -svport " ) ;
if ( ! p )
p = COM_CheckParm ( " -port " ) ;
if ( p & & p < com_argc )
Cvar_Set ( Cvar_FindVar ( " sv_port " ) , com_argv [ p + 1 ] ) ;
}
2013-06-23 02:17:02 +00:00
void SV_ExecInitialConfigs ( char * defaultexec )
{
2015-12-12 19:25:15 +00:00
Cbuf_AddText ( " cvar_purgedefaults \n " , RESTRICT_LOCAL ) ; //reset cvar defaults to their engine-specified values. the tail end of 'exec default.cfg' will update non-cheat defaults to mod-specified values.
Cbuf_AddText ( " cvarreset * \n " , RESTRICT_LOCAL ) ; //reset all cvars to their current (engine) defaults
2018-08-23 06:03:31 +00:00
Cbuf_AddText ( " alias restart \" map_restart \" \n " , RESTRICT_LOCAL ) ;
2016-08-25 00:12:14 +00:00
Cbuf_AddText ( va ( " sv_gamedir \" %s \" \n " , FS_GetGamedir ( true ) ) , RESTRICT_LOCAL ) ;
2022-03-01 02:51:55 +00:00
Cbuf_AddText ( " cl_warncmd 0 \n " , RESTRICT_LOCAL ) ;
2015-12-12 19:25:15 +00:00
Cbuf_AddText ( defaultexec , RESTRICT_LOCAL ) ;
2022-03-01 02:51:55 +00:00
Cbuf_AddText ( " cl_warncmd 1 \n " , RESTRICT_LOCAL ) ;
2015-12-12 19:25:15 +00:00
Cbuf_AddText ( " \n " , RESTRICT_LOCAL ) ;
2019-05-10 09:31:21 +00:00
//make sure +set args override fmf/engine defaults (redundant when there's no map/etc command in configs)
COM_ParsePlusSets ( true ) ;
2015-12-12 19:25:15 +00:00
2013-06-23 02:17:02 +00:00
if ( COM_FileSize ( " server.cfg " ) ! = - 1 )
2015-12-12 19:25:15 +00:00
Cbuf_AddText ( " cl_warncmd 1 \n exec server.cfg \n exec ftesrv.cfg \n " , RESTRICT_LOCAL ) ;
2014-12-23 15:26:42 +00:00
else if ( COM_FileSize ( " quake.rc " ) ! = - 1 )
2015-12-12 19:25:15 +00:00
Cbuf_AddText ( " cl_warncmd 0 \n exec quake.rc \n cl_warncmd 1 \n exec ftesrv.cfg \n " , RESTRICT_LOCAL ) ;
# ifdef HEXEN2
else if ( COM_FileSize ( " hexen.rc " ) ! = - 1 ) //fixme: some kind of priority thing.
Cbuf_AddText ( " cl_warncmd 0 \n exec hexen.rc \n cl_warncmd 1 \n exec ftesrv.cfg \n " , RESTRICT_LOCAL ) ;
# endif
2014-12-23 15:26:42 +00:00
else
2015-12-12 19:25:15 +00:00
Cbuf_AddText ( " cl_warncmd 0 \n exec default.cfg \n cl_warncmd 1 \n exec ftesrv.cfg \n " , RESTRICT_LOCAL ) ;
2013-06-23 02:17:02 +00:00
2019-05-10 09:31:21 +00:00
//make sure +set stuff still applies...
COM_ParsePlusSets ( true ) ;
2013-06-23 02:17:02 +00:00
// process command line arguments
Cbuf_Execute ( ) ;
2016-01-18 05:22:07 +00:00
SV_ArgumentOverrides ( ) ;
2013-06-23 02:17:02 +00:00
}
2004-08-23 00:15:46 +00:00
void SV_Init ( quakeparms_t * parms )
{
if ( isDedicated )
{
COM_InitArgv ( parms - > argc , parms - > argv ) ;
host_parms = * parms ;
2010-07-11 02:22:39 +00:00
Cvar_Init ( ) ;
2013-07-14 12:22:51 +00:00
Memory_Init ( ) ;
2004-08-23 00:15:46 +00:00
2007-06-20 00:02:54 +00:00
Sys_Init ( ) ;
2014-10-05 20:04:11 +00:00
COM_ParsePlusSets ( false ) ;
2005-01-16 02:23:31 +00:00
2004-08-23 00:15:46 +00:00
Cbuf_Init ( ) ;
Cmd_Init ( ) ;
# ifndef SERVERONLY
2010-02-06 01:25:04 +00:00
R_SetRenderer ( NULL ) ;
2004-08-23 00:15:46 +00:00
# endif
2013-06-23 02:17:02 +00:00
NET_Init ( ) ;
2004-08-23 00:15:46 +00:00
COM_Init ( ) ;
2018-04-08 14:24:50 +00:00
# if defined(Q2BSPS) || defined(Q3BSPS)
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
CM_Init ( ) ;
# endif
# ifdef TERRAIN
Terr_Init ( ) ;
# endif
2013-10-29 17:38:22 +00:00
Mod_Init ( true ) ;
Mod_Init ( false ) ;
2006-05-09 00:02:05 +00:00
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
PF_Common_RegisterCvars ( ) ;
}
else
{
2012-05-11 01:57:00 +00:00
# if defined(SERVERONLY) || !(defined(CSQC_DAT) || defined(MENU_DAT))
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
PF_Common_RegisterCvars ( ) ;
2012-05-10 19:14:25 +00:00
# endif
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
}
2012-05-10 19:14:25 +00:00
2005-07-03 15:16:20 +00:00
PR_Init ( ) ;
2004-08-23 00:15:46 +00:00
SV_InitNet ( ) ;
SV_InitLocal ( ) ;
2010-03-14 14:35:56 +00:00
# ifdef WEBSERVER
2004-08-23 00:15:46 +00:00
IWebInit ( ) ;
# endif
2005-07-03 15:16:20 +00:00
2009-11-07 13:29:15 +00:00
# ifdef SERVER_DEMO_PLAYBACK
2004-08-23 00:15:46 +00:00
SV_Demo_Init ( ) ;
2009-11-07 13:29:15 +00:00
# endif
2004-08-23 00:15:46 +00:00
# ifdef SVRANKING
Rank_RegisterCommands ( ) ;
# endif
# ifndef SERVERONLY
if ( isDedicated )
# endif
{
2016-07-12 00:40:13 +00:00
int manarg ;
2004-08-23 00:15:46 +00:00
PM_Init ( ) ;
2005-12-15 19:15:39 +00:00
# ifdef PLUGINS
2013-05-03 04:28:08 +00:00
Plug_Initialise ( true ) ;
2005-12-15 19:15:39 +00:00
# endif
2016-08-25 00:12:14 +00:00
Cvar_ParseWatches ( ) ;
2004-08-23 00:15:46 +00:00
host_initialized = true ;
2005-07-03 15:16:20 +00:00
2005-12-15 19:15:39 +00:00
2016-07-12 00:40:13 +00:00
manarg = COM_CheckParm ( " -manifest " ) ;
if ( manarg & & manarg < com_argc - 1 & & com_argv [ manarg + 1 ] )
2020-04-19 01:23:32 +00:00
FS_ChangeGame ( FS_Manifest_ReadSystem ( com_argv [ manarg + 1 ] , NULL ) , true , true ) ;
2016-07-12 00:40:13 +00:00
else
FS_ChangeGame ( NULL , true , true ) ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
Cmd_StuffCmds ( ) ;
2004-08-23 00:15:46 +00:00
Cbuf_Execute ( ) ;
2019-03-23 07:06:37 +00:00
Menu_Download_Update ( ) ;
2020-03-08 07:02:37 +00:00
# ifdef MANIFESTDOWNLOADS
2019-03-23 07:06:37 +00:00
if ( Sys_RunInstaller ( ) )
Sys_Quit ( ) ;
# endif
2005-01-16 02:23:31 +00:00
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
Con_Printf ( " Exe: %s \n " , version_string ( ) ) ;
2013-06-23 02:17:02 +00:00
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " ======== %s Initialized ======== \n " , * fs_gamename . string ? fs_gamename . string : " Nothing " ) ;
2008-11-09 22:29:28 +00:00
2014-03-30 08:55:06 +00:00
# ifdef SUBSERVERS
if ( SSV_IsSubServer ( ) )
{
NET_InitServer ( ) ;
return ;
}
# endif
2018-11-19 06:37:25 +00:00
# ifdef IPLOG
IPLog_Merge_File ( " iplog.txt " ) ; //should be compatible with DP's take on the feature.
2017-02-11 17:16:51 +00:00
IPLog_Merge_File ( " iplog.dat " ) ; //legacy crap, for compat with proquake
2018-11-19 06:37:25 +00:00
# endif
2017-02-11 17:16:51 +00:00
2013-06-23 02:17:02 +00:00
// if a map wasn't specified on the command line, spawn start.map
//aliases require that we flush the cbuf in order to actually see the results.
2021-10-22 22:27:58 +00:00
if ( sv . state = = ss_dead & & Cmd_AliasExist ( " dedicated_start " , RESTRICT_LOCAL ) )
{
Cbuf_AddText ( " dedicated_start " , RESTRICT_LOCAL ) ; //Q2 feature
Cbuf_Execute ( ) ;
}
2009-04-01 22:03:56 +00:00
if ( sv . state = = ss_dead & & Cmd_AliasExist ( " startmap_dm " , RESTRICT_LOCAL ) )
{
Cbuf_AddText ( " startmap_dm " , RESTRICT_LOCAL ) ; //DP extension
Cbuf_Execute ( ) ;
}
if ( sv . state = = ss_dead & & Cmd_AliasExist ( " startmap_sp " , RESTRICT_LOCAL ) )
2005-07-01 19:23:00 +00:00
{
2009-04-01 22:03:56 +00:00
Cbuf_AddText ( " startmap_sp " , RESTRICT_LOCAL ) ; //DP extension
Cbuf_Execute ( ) ;
2005-07-01 19:23:00 +00:00
}
2011-05-29 04:26:29 +00:00
if ( sv . state = = ss_dead & & COM_FCheckExists ( " maps/start.bsp " ) )
2009-04-01 22:03:56 +00:00
Cmd_ExecuteString ( " map start " , RESTRICT_LOCAL ) ; //regular q1
2014-09-20 04:11:39 +00:00
# ifdef HEXEN2
2011-05-29 04:26:29 +00:00
if ( sv . state = = ss_dead & & COM_FCheckExists ( " maps/demo1.bsp " ) )
2009-04-01 22:03:56 +00:00
Cmd_ExecuteString ( " map demo1 " , RESTRICT_LOCAL ) ; //regular h2 sp
2014-09-20 04:11:39 +00:00
# endif
2013-06-23 02:17:02 +00:00
# ifdef Q2SERVER
2011-05-29 04:26:29 +00:00
if ( sv . state = = ss_dead & & COM_FCheckExists ( " maps/base1.bsp " ) )
2009-04-01 22:03:56 +00:00
Cmd_ExecuteString ( " map base1 " , RESTRICT_LOCAL ) ; //regular q2 sp
2013-06-23 02:17:02 +00:00
# endif
# ifdef Q3SERVER
2011-05-29 04:26:29 +00:00
if ( sv . state = = ss_dead & & COM_FCheckExists ( " maps/q3dm1.bsp " ) )
2009-04-01 22:03:56 +00:00
Cmd_ExecuteString ( " map q3dm1 " , RESTRICT_LOCAL ) ; //regular q3 'sp'
2013-06-23 02:17:02 +00:00
# endif
# ifdef HLSERVER
2009-04-01 22:03:56 +00:00
if ( sv . state = = ss_dead & & COM_FCheckExists ( " maps/c0a0.bsp " ) )
Cmd_ExecuteString ( " map c0a0 " , RESTRICT_LOCAL ) ; //regular hl sp
2013-06-23 02:17:02 +00:00
# endif
2009-04-01 22:03:56 +00:00
2004-08-23 00:15:46 +00:00
if ( sv . state = = ss_dead )
2015-12-28 17:41:39 +00:00
{
Cmd_ExecuteString ( " path " , RESTRICT_LOCAL ) ;
SV_Error ( " Couldn't load a map. You may need to use the -basedir argument. " ) ;
}
2013-06-23 02:17:02 +00:00
2004-08-23 00:15:46 +00:00
}
}
2004-11-29 01:21:00 +00:00
# endif
2010-02-06 01:25:04 +00:00