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"
2016-01-18 05:22:07 +00:00
# include "pr_common.h"
2019-07-02 04:12:20 +00:00
# ifdef SQL
# include "sv_sql.h"
# endif
2022-03-01 02:51:46 +00:00
# ifdef __GLIBC__
# include <malloc.h> //for malloc_trim
# endif
2004-11-29 01:21:00 +00:00
# ifndef CLIENTONLY
2004-08-23 00:15:46 +00:00
extern int total_loading_size , current_loading_size , loading_stage ;
char * T_GetString ( int num ) ;
2015-05-03 19:57:46 +00:00
void SVQ2_Ents_Shutdown ( void ) ;
2005-03-20 02:57:11 +00:00
# define Q2EDICT_NUM(i) (q2edict_t*)((char *)ge->edicts+(i)*ge->edict_size)
2004-08-23 00:15:46 +00:00
server_static_t svs ; // persistant server info
server_t sv ; // local server
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
entity_state_t * sv_staticentities ;
int sv_max_staticentities ;
2015-04-14 23:12:17 +00:00
staticsound_state_t * sv_staticsounds ;
int sv_max_staticsounds ;
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
2014-10-05 20:04:11 +00:00
extern cvar_t skill ;
2004-08-23 00:15:46 +00:00
extern cvar_t sv_cheats ;
2004-11-17 17:49:18 +00:00
extern cvar_t sv_bigcoords ;
2005-03-20 02:57:11 +00:00
extern cvar_t sv_gamespeed ;
2009-05-24 10:11:17 +00:00
extern cvar_t sv_csqc_progname ;
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
extern cvar_t sv_calcphs ;
2014-03-30 08:55:06 +00:00
extern cvar_t sv_playerslots , maxclients , maxspectators ;
2018-06-02 08:55:57 +00:00
extern cvar_t sv_nqplayerphysics ; //auto setting needs updating on map changes
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = =
SV_ModelIndex
= = = = = = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
int SV_ModelIndex ( const char * name )
2004-08-23 00:15:46 +00:00
{
int i ;
2005-07-03 15:16:20 +00:00
2004-08-23 00:15:46 +00:00
if ( ! name | | ! name [ 0 ] )
return 0 ;
2014-09-17 03:04:08 +00:00
for ( i = 1 ; i < MAX_PRECACHE_MODELS & & sv . strings . model_precache [ i ] ; i + + )
2006-02-17 02:51:59 +00:00
if ( ! strcmp ( sv . strings . model_precache [ i ] , name ) )
2004-08-23 00:15:46 +00:00
return i ;
2014-09-17 03:04:08 +00:00
if ( i = = MAX_PRECACHE_MODELS | | ! sv . strings . model_precache [ i ] )
2004-09-04 17:56:53 +00:00
{
2014-09-17 03:04:08 +00:00
if ( i ! = MAX_PRECACHE_MODELS )
2004-09-04 17:56:53 +00:00
{
2011-12-05 15:23:40 +00:00
# ifdef VM_Q1
if ( svs . gametype = = GT_Q1QVM )
sv . strings . model_precache [ i ] = name ;
else
# endif
2013-11-21 23:02:28 +00:00
sv . strings . model_precache [ i ] = PR_AddString ( svprogfuncs , name , 0 , false ) ;
2004-09-04 17:56:53 +00:00
if ( ! strcmp ( name + strlen ( name ) - 4 , " .bsp " ) )
2014-10-05 20:04:11 +00:00
sv . models [ i ] = Mod_FindName ( Mod_FixName ( sv . strings . model_precache [ i ] , sv . strings . model_precache [ 1 ] ) ) ;
2011-12-05 15:23:40 +00:00
Con_DPrintf ( " WARNING: SV_ModelIndex: model %s not precached \n " , name ) ;
if ( sv . state ! = ss_loading )
{
MSG_WriteByte ( & sv . reliable_datagram , svcfte_precache ) ;
MSG_WriteShort ( & sv . reliable_datagram , i ) ;
MSG_WriteString ( & sv . reliable_datagram , sv . strings . model_precache [ i ] ) ;
# ifdef NQPROT
MSG_WriteByte ( & sv . nqreliable_datagram , svcdp_precache ) ;
MSG_WriteShort ( & sv . nqreliable_datagram , i ) ;
MSG_WriteString ( & sv . nqreliable_datagram , sv . strings . model_precache [ i ] ) ;
# endif
}
2004-09-04 17:56:53 +00:00
}
}
2004-08-23 00:15:46 +00:00
return i ;
}
2014-10-05 20:04:11 +00:00
//looks up a name->index without caching it
2004-11-19 17:45:22 +00:00
int SV_SafeModelIndex ( char * name )
{
int i ;
2005-07-03 15:16:20 +00:00
2004-11-19 17:45:22 +00:00
if ( ! name | | ! name [ 0 ] )
return 0 ;
2014-09-17 03:04:08 +00:00
for ( i = 1 ; i < MAX_PRECACHE_MODELS & & sv . strings . model_precache [ i ] ; i + + )
2006-02-17 02:51:59 +00:00
if ( ! strcmp ( sv . strings . model_precache [ i ] , name ) )
2004-11-19 17:45:22 +00:00
return i ;
2014-09-17 03:04:08 +00:00
if ( i = = MAX_PRECACHE_MODELS | | ! sv . strings . model_precache [ i ] )
2004-11-19 17:45:22 +00:00
{
return 0 ;
}
return i ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = =
SV_FlushSignon
Moves to the next signon buffer if needed
2019-09-17 19:49:39 +00:00
This stops any chunk from getting too large , hopefully , but if the worst happens then hopefully network fragmentation will work .
2004-08-23 00:15:46 +00:00
= = = = = = = = = = = = = = = =
*/
2019-09-17 19:49:39 +00:00
void SV_FlushSignon ( qboolean force )
{ //flush only when it gets too big.
if ( sv . signon . cursize < MAX_DATAGRAM - 512 )
{
if ( ! force | | ! sv . signon . cursize )
return ;
}
2004-08-23 00:15:46 +00:00
2019-09-17 19:49:39 +00:00
if ( sv . signon . cursize )
{
sv . signon . data [ - 2 ] = ( sv . signon . cursize > > 0 ) & 0xff ;
sv . signon . data [ - 1 ] = ( sv . signon . cursize > > 8 ) & 0xff ;
sv . used_signon_space + = 2 + sv . signon . cursize ;
}
2004-08-23 00:15:46 +00:00
2019-09-17 19:49:39 +00:00
sv . signon . data = sv . signon_buffer + sv . used_signon_space + 2 ;
sv . signon . maxsize = sizeof ( sv . signon_buffer ) - ( sv . used_signon_space + 2 ) ;
2004-08-23 00:15:46 +00:00
sv . signon . cursize = 0 ;
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
sv . signon . prim = svs . netprim ;
2004-08-23 00:15:46 +00:00
}
2009-11-07 13:29:15 +00:00
# ifdef SERVER_DEMO_PLAYBACK
2004-08-23 00:15:46 +00:00
void SV_FlushDemoSignon ( void )
{
if ( sv . demosignon . cursize < sv . demosignon . maxsize - 512 )
return ;
if ( sv . num_demosignon_buffers = = MAX_SIGNON_BUFFERS - 1 )
SV_Error ( " sv.num_demosignon_buffers == MAX_SIGNON_BUFFERS-1 " ) ;
sv . demosignon_buffer_size [ sv . num_demosignon_buffers - 1 ] = sv . demosignon . cursize ;
sv . demosignon . data = sv . demosignon_buffers [ sv . num_demosignon_buffers ] ;
sv . num_demosignon_buffers + + ;
sv . demosignon . cursize = 0 ;
}
2009-11-07 13:29:15 +00:00
# endif
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = =
SV_CreateBaseline
Entity baselines are used to compress the update messages
to the clients - - only the fields that differ from the
baseline will be transmitted
= = = = = = = = = = = = = = = =
*/
/*void SV_CreateBaseline (void)
{
int i ;
edict_t * svent ;
2005-07-03 15:16:20 +00:00
int entnum ;
2004-08-23 00:15:46 +00:00
for ( entnum = 0 ; entnum < sv . num_edicts ; entnum + + )
{
svent = EDICT_NUM ( entnum ) ;
if ( svent - > free )
continue ;
// create baselines for all player slots,
// and any other edict that has a visible model
2013-12-02 14:30:30 +00:00
if ( entnum > svs . allocated_client_slots & & ! svent - > v - > modelindex )
2004-08-23 00:15:46 +00:00
continue ;
//
// create entity baseline
//
2005-03-28 00:11:59 +00:00
VectorCopy ( svent - > v - > origin , svent - > baseline . origin ) ;
VectorCopy ( svent - > v - > angles , svent - > baseline . angles ) ;
svent - > baseline . frame = svent - > v - > frame ;
svent - > baseline . skinnum = svent - > v - > skin ;
2013-12-02 14:30:30 +00:00
if ( entnum > 0 & & entnum < = svs . allocated_client_slots )
2004-08-23 00:15:46 +00:00
{
svent - > baseline . colormap = entnum ;
svent - > baseline . modelindex = SV_ModelIndex ( " progs/player.mdl " ) & 255 ;
}
else
{
svent - > baseline . colormap = 0 ;
svent - > baseline . modelindex =
2005-03-28 00:11:59 +00:00
SV_ModelIndex ( PR_GetString ( svent - > v - > model ) ) & 255 ;
2004-08-23 00:15:46 +00:00
}
# ifdef PEXT_SCALE
svent - > baseline . scale = 1 ;
# endif
# ifdef PEXT_TRANS
svent - > baseline . trans = 1 ;
# endif
//
// flush the signon message out to a seperate buffer if
// nearly full
//
SV_FlushSignon ( ) ;
//
// add to the message
//
2005-07-03 15:16:20 +00:00
MSG_WriteByte ( & sv . signon , svc_spawnbaseline ) ;
2004-08-23 00:15:46 +00:00
MSG_WriteShort ( & sv . signon , entnum ) ;
MSG_WriteByte ( & sv . signon , svent - > baseline . modelindex ) ;
MSG_WriteByte ( & sv . signon , svent - > baseline . frame ) ;
MSG_WriteByte ( & sv . signon , svent - > baseline . colormap ) ;
MSG_WriteByte ( & sv . signon , svent - > baseline . skinnum ) ;
for ( i = 0 ; i < 3 ; i + + )
{
MSG_WriteCoord ( & sv . signon , svent - > baseline . origin [ i ] ) ;
MSG_WriteAngle ( & sv . signon , svent - > baseline . angles [ i ] ) ;
}
}
}
*/
2006-02-27 00:42:25 +00:00
2015-10-11 11:34:58 +00:00
void SVQ1_CreateBaseline ( void )
2004-08-23 00:15:46 +00:00
{
edict_t * svent ;
2005-07-03 15:16:20 +00:00
int entnum ;
2012-02-12 05:18:31 +00:00
extern entity_state_t nullentitystate ;
2004-11-19 17:45:22 +00:00
int playermodel = SV_SafeModelIndex ( " progs/player.mdl " ) ;
2005-07-03 15:16:20 +00:00
2009-11-04 21:16:50 +00:00
for ( entnum = 0 ; entnum < sv . world . num_edicts ; entnum + + )
2004-08-23 00:15:46 +00:00
{
2018-04-06 17:21:15 +00:00
svent = EDICT_NUM_PB ( svprogfuncs , entnum ) ;
2004-08-23 00:15:46 +00:00
2012-02-12 05:18:31 +00:00
memcpy ( & svent - > baseline , & nullentitystate , sizeof ( entity_state_t ) ) ;
2004-08-23 00:15:46 +00:00
svent - > baseline . number = entnum ;
2016-07-21 19:27:59 +00:00
if ( ED_ISFREE ( svent ) )
2004-08-23 00:15:46 +00:00
continue ;
// create baselines for all player slots,
// and any other edict that has a visible model
2005-03-28 00:11:59 +00:00
if ( entnum > sv . allocated_client_slots & & ! svent - > v - > modelindex )
2004-08-23 00:15:46 +00:00
continue ;
//
// create entity baseline
//
2016-07-12 00:40:13 +00:00
SV_Snapshot_BuildStateQ1 ( & svent - > baseline , svent , NULL , NULL ) ;
2006-02-27 00:42:25 +00:00
2004-08-23 00:15:46 +00:00
if ( entnum > 0 & & entnum < = sv . allocated_client_slots )
{
if ( entnum > 0 & & entnum < = 16 )
svent - > baseline . colormap = entnum ;
else
svent - > baseline . colormap = 0 ; //this would crash NQ.
2004-11-19 17:45:22 +00:00
2016-07-12 00:40:13 +00:00
if ( ! svent - > baseline . solidsize )
svent - > baseline . solidsize = ES_SOLID_HULL1 ;
2012-02-14 15:50:34 +00:00
if ( ! svent - > baseline . modelindex )
svent - > baseline . modelindex = playermodel ;
2004-08-23 00:15:46 +00:00
}
2013-12-29 22:48:28 +00:00
svent - > baseline . modelindex & = 255 ; //FIXME
2014-10-11 19:39:45 +00:00
if ( ! svent - > baseline . modelindex )
{
memcpy ( & svent - > baseline , & nullentitystate , sizeof ( entity_state_t ) ) ;
svent - > baseline . number = entnum ;
}
2004-08-23 00:15:46 +00:00
}
}
2017-05-28 15:42:32 +00:00
void SV_SpawnParmsToQC ( client_t * client )
2014-03-30 08:55:06 +00:00
{
2017-05-28 15:42:32 +00:00
int i ;
// copy spawn parms out of the client_t
for ( i = 0 ; i < NUM_SPAWN_PARMS ; i + + )
2014-03-30 08:55:06 +00:00
{
2017-05-28 15:42:32 +00:00
if ( pr_global_ptrs - > spawnparamglobals [ i ] )
* pr_global_ptrs - > spawnparamglobals [ i ] = client - > spawn_parms [ i ] ;
2014-03-30 08:55:06 +00:00
}
2017-05-28 15:42:32 +00:00
if ( pr_global_ptrs - > parm_string )
* pr_global_ptrs - > parm_string = client - > spawn_parmstring ? PR_TempString ( sv . world . progs , client - > spawn_parmstring ) : 0 ;
}
void SV_SpawnParmsToClient ( client_t * client )
{
int i ;
for ( i = 0 ; i < NUM_SPAWN_PARMS ; i + + )
{
if ( pr_global_ptrs - > spawnparamglobals [ i ] )
client - > spawn_parms [ i ] = * pr_global_ptrs - > spawnparamglobals [ i ] ;
else
client - > spawn_parms [ i ] = 0 ;
}
Z_Free ( client - > spawn_parmstring ) ;
if ( pr_global_ptrs - > parm_string )
client - > spawn_parmstring = Z_StrDup ( PR_GetString ( sv . world . progs , * pr_global_ptrs - > parm_string ) ) ;
else
client - > spawn_parmstring = NULL ;
}
void SV_SaveSpawnparmsClient ( client_t * client , float * transferparms )
{
int j ;
2018-04-06 17:21:15 +00:00
eval_t * eval ;
2017-05-28 15:42:32 +00:00
SV_SpawnParmsToQC ( client ) ;
2014-03-30 08:55:06 +00:00
# ifdef VM_Q1
if ( svs . gametype = = GT_Q1QVM )
{
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , client - > edict ) ;
Q1QVM_SetChangeParms ( ) ;
}
2014-08-25 07:35:41 +00:00
else
2014-03-30 08:55:06 +00:00
# endif
2014-08-25 07:35:41 +00:00
if ( pr_global_ptrs - > SetChangeParms )
2014-03-30 08:55:06 +00:00
{
func_t setparms = 0 ;
if ( transferparms )
{
setparms = PR_FindFunction ( svprogfuncs , " SetTransferParms " , PR_ANY ) ;
if ( ! setparms )
setparms = pr_global_struct - > SetChangeParms ;
}
else
setparms = pr_global_struct - > SetChangeParms ;
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , client - > edict ) ;
PR_ExecuteProgram ( svprogfuncs , setparms ) ;
}
if ( transferparms )
{
for ( j = 0 ; j < NUM_SPAWN_PARMS ; j + + )
{
if ( pr_global_ptrs - > spawnparamglobals [ j ] )
transferparms [ j ] = * pr_global_ptrs - > spawnparamglobals [ j ] ;
}
return ;
}
else
{
2017-05-28 15:42:32 +00:00
SV_SpawnParmsToClient ( client ) ;
2014-03-30 08:55:06 +00:00
}
// call the progs to get default spawn parms for the new client
2018-04-06 17:21:15 +00:00
eval = PR_FindGlobal ( svprogfuncs , " ClientReEnter " , 0 , NULL ) ;
if ( eval & & eval - > function )
2014-03-30 08:55:06 +00:00
{ //oooh, evil.
char buffer [ 65536 * 4 ] ;
2015-11-18 07:37:39 +00:00
size_t bufsize = 0 ;
2014-03-30 08:55:06 +00:00
char * buf ;
2021-09-01 07:30:48 +00:00
// for (j=0 ; j<NUM_SPAWN_PARMS ; j++)
// client->spawn_parms[j] = 0;
2014-03-30 08:55:06 +00:00
buf = svprogfuncs - > saveent ( svprogfuncs , buffer , & bufsize , sizeof ( buffer ) , client - > edict ) ;
if ( client - > spawninfo )
Z_Free ( client - > spawninfo ) ;
client - > spawninfo = Z_Malloc ( bufsize + 1 ) ;
memcpy ( client - > spawninfo , buf , bufsize + 1 ) ;
client - > spawninfotime = sv . time ;
}
# ifdef SVRANKING
if ( client - > rankid )
{
rankstats_t rs ;
if ( Rank_GetPlayerStats ( client - > rankid , & rs ) )
{
rs . timeonserver + = realtime - client - > stats_started ;
client - > stats_started = realtime ;
rs . kills + = client - > kills ;
rs . deaths + = client - > deaths ;
client - > kills = 0 ;
client - > deaths = 0 ;
2014-08-25 07:35:41 +00:00
for ( j = 0 ; j < NUM_RANK_SPAWN_PARMS ; j + + )
2014-03-30 08:55:06 +00:00
{
rs . parm [ j ] = client - > spawn_parms [ j ] ;
}
Rank_SetPlayerStats ( client - > rankid , & rs ) ;
}
}
# endif
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = =
SV_SaveSpawnparms
2005-07-03 15:16:20 +00:00
Grabs the current state of the progs serverinfo flags
2004-08-23 00:15:46 +00:00
and each client for saving across the
transition to another level
= = = = = = = = = = = = = = = =
*/
2014-03-30 08:55:06 +00:00
void SV_SaveSpawnparms ( void )
2004-08-23 00:15:46 +00:00
{
2014-03-30 08:55:06 +00:00
int i ;
2004-08-23 00:15:46 +00:00
if ( ! sv . state )
return ; // no progs loaded yet
if ( ! svprogfuncs )
return ;
// serverflags is the only game related thing maintained
svs . serverflags = pr_global_struct - > serverflags ;
2011-04-25 03:25:22 +00:00
for ( i = 0 , host_client = svs . clients ; i < sv . allocated_client_slots ; i + + , host_client + + )
2004-08-23 00:15:46 +00:00
{
if ( host_client - > state ! = cs_spawned )
continue ;
2014-03-30 08:55:06 +00:00
SV_SaveSpawnparmsClient ( host_client , NULL ) ;
2004-08-23 00:15:46 +00:00
}
}
2014-08-25 07:35:41 +00:00
void SV_GetNewSpawnParms ( client_t * cl )
{
if ( svprogfuncs ) //q2 dlls don't use parms in this manner. It's all internal to the dll.
{
// call the progs to get default spawn parms for the new client
# ifdef VM_Q1
if ( svs . gametype = = GT_Q1QVM )
Q1QVM_SetNewParms ( ) ;
else
# endif
{
if ( pr_global_ptrs - > SetNewParms )
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > SetNewParms ) ;
}
2017-05-28 15:42:32 +00:00
SV_SpawnParmsToClient ( cl ) ;
2014-08-25 07:35:41 +00:00
}
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = =
SV_CalcPHS
Expands the PVS and calculates the PHS
( Potentially Hearable Set )
= = = = = = = = = = = = = = = =
*/
void SV_CalcPHS ( void )
{
int rowbytes , rowwords ;
int i , j , k , l , index , num ;
int bitbyte ;
unsigned * dest , * src ;
2017-06-22 16:49:29 +00:00
qbyte * scan , * pvs ;
2004-08-23 00:15:46 +00:00
int count , vcount ;
2015-06-14 12:26:01 +00:00
model_t * model = sv . world . worldmodel ;
2017-06-21 01:24:25 +00:00
pvsbuffer_t buf ;
2004-08-23 00:15:46 +00:00
2015-06-14 12:26:01 +00:00
if ( model - > pvs | | model - > fromgame = = fg_quake2 | | model - > fromgame = = fg_quake3 )
2004-08-23 00:15:46 +00:00
{
//PHS calcs are pointless with Q2 bsps
return ;
}
2015-06-14 12:26:01 +00:00
//FIXME: this can take a significant time on some maps, and should ideally be pushed to a worker thread.
num = model - > numclusters ;
2017-06-21 01:24:25 +00:00
rowbytes = model - > pvsbytes ;
rowwords = rowbytes / sizeof ( * dest ) ;
buf . buffersize = model - > pvsbytes ;
2004-08-23 00:15:46 +00:00
2012-02-27 12:23:15 +00:00
if ( ! sv_calcphs . ival | | ( sv_calcphs . ival = = 2 & & ( rowbytes * num > = 0x100000 | | ( ! deathmatch . ival & & ! coop . ival ) ) ) )
{
2017-06-21 01:24:25 +00:00
pvs = NULL ; /*ZG_Malloc(&model->memgroup, rowbytes*num);
scan = pvs ;
2012-02-27 12:23:15 +00:00
for ( i = 0 ; i < num ; i + + , scan + = rowbytes )
{
2017-06-21 01:24:25 +00:00
buf . buffer = scan ;
model - > funcs . ClusterPVS ( model , i , & buf , PVM_REPLACE ) ;
} */
2012-02-27 12:23:15 +00:00
Con_DPrintf ( " Skipping PHS \n " ) ;
2017-06-21 01:24:25 +00:00
model - > pvs = pvs ;
2015-06-14 12:26:01 +00:00
model - > phs = NULL ;
2012-02-27 12:23:15 +00:00
return ;
}
2010-07-25 15:07:19 +00:00
2017-06-21 01:24:25 +00:00
pvs = ZG_Malloc ( & model - > memgroup , rowbytes * num ) ;
scan = pvs ;
2004-08-23 00:15:46 +00:00
vcount = 0 ;
for ( i = 0 ; i < num ; i + + , scan + = rowbytes )
{
2017-06-21 01:24:25 +00:00
buf . buffer = scan ;
model - > funcs . ClusterPVS ( model , i , & buf , PVM_REPLACE ) ;
2004-08-23 00:15:46 +00:00
if ( i = = 0 )
continue ;
for ( j = 0 ; j < num ; j + + )
{
if ( scan [ j > > 3 ] & ( 1 < < ( j & 7 ) ) )
{
vcount + + ;
}
}
}
2012-02-27 12:23:15 +00:00
if ( developer . value )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Building PHS... \n " ) ;
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
2017-06-21 01:24:25 +00:00
model - > pvs = pvs ;
2015-06-14 12:26:01 +00:00
model - > phs = ZG_Malloc ( & model - > memgroup , rowbytes * num ) ;
2013-07-14 12:22:51 +00:00
2010-07-25 15:07:19 +00:00
/*this routine takes an exponential amount of time, so cache it if its too big*/
if ( rowbytes * num > = 0x100000 )
{
2013-07-14 12:22:51 +00:00
char hdr [ 8 ] ;
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
vfsfile_t * f = FS_OpenVFS ( va ( " maps/%s.phs " , svs . name ) , " rb " , FS_GAME ) ;
2013-07-14 12:22:51 +00:00
if ( f )
2010-07-25 15:07:19 +00:00
{
2013-07-14 12:22:51 +00:00
VFS_READ ( f , hdr , sizeof ( hdr ) ) ;
2017-07-04 05:07:51 +00:00
if ( ! memcmp ( hdr , " QPHS \1 \0 \0 \0 " , 8 ) & & VFS_GETLEN ( f ) = = rowbytes * num + 8 )
2013-07-14 12:22:51 +00:00
{
2015-06-14 12:26:01 +00:00
VFS_READ ( f , model - > phs , rowbytes * num ) ;
2013-07-14 12:22:51 +00:00
VFS_CLOSE ( f ) ;
Con_DPrintf ( " Loaded cached PHS \n " ) ;
return ;
}
else
Con_DPrintf ( " Stale cached PHS \n " ) ;
VFS_CLOSE ( f ) ;
2010-07-25 15:07:19 +00:00
}
}
2004-08-23 00:15:46 +00:00
count = 0 ;
2017-06-21 01:24:25 +00:00
scan = pvs ;
2015-06-14 12:26:01 +00:00
dest = ( unsigned * ) model - > phs ;
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < num ; i + + , dest + = rowwords , scan + = rowbytes )
{
memcpy ( dest , scan , rowbytes ) ;
for ( j = 0 ; j < rowbytes ; j + + )
{
bitbyte = scan [ j ] ;
if ( ! bitbyte )
continue ;
for ( k = 0 ; k < 8 ; k + + )
{
if ( ! ( bitbyte & ( 1 < < k ) ) )
continue ;
// or this pvs row into the phs
// +1 because pvs is 1 based
2014-05-23 02:02:51 +00:00
//except we now use clusters internally, which are 0-based (ie: leaf 0 is invalid and maps to cluster -1)
index = ( ( j < < 3 ) + k ) ;
2004-08-23 00:15:46 +00:00
if ( index > = num )
continue ;
2017-06-21 01:24:25 +00:00
src = ( unsigned * ) pvs + index * rowwords ;
2004-08-23 00:15:46 +00:00
for ( l = 0 ; l < rowwords ; l + + )
dest [ l ] | = src [ l ] ;
}
}
if ( i = = 0 )
continue ;
for ( j = 0 ; j < num ; j + + )
if ( ( ( qbyte * ) dest ) [ j > > 3 ] & ( 1 < < ( j & 7 ) ) )
count + + ;
}
2010-07-25 15:07:19 +00:00
if ( rowbytes * num > = 0x100000 )
{
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
vfsfile_t * f = FS_OpenVFS ( va ( " maps/%s.phs " , svs . name ) , " wb " , FS_GAMEONLY ) ;
2010-07-25 15:07:19 +00:00
if ( f )
{
VFS_WRITE ( f , " QPHS \1 \0 \0 \0 " , 8 ) ;
2015-06-14 12:26:01 +00:00
VFS_WRITE ( f , model - > phs , rowbytes * num ) ;
2010-07-25 15:07:19 +00:00
VFS_CLOSE ( f ) ;
Con_Printf ( " Written PHS cache (%u bytes) \n " , rowbytes * num ) ;
}
}
2004-08-23 00:15:46 +00:00
if ( num )
2004-10-18 10:49:19 +00:00
if ( developer . value )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Average leafs visible / hearable / total: %i / %i / %i \n " , vcount / num , count / num , num ) ;
2004-08-23 00:15:46 +00:00
}
unsigned SV_CheckModel ( char * mdl )
{
2014-10-05 20:04:11 +00:00
size_t fsize ;
2004-08-23 00:15:46 +00:00
qbyte * buf ;
unsigned short crc ;
2018-07-05 16:21:44 +00:00
buf = ( qbyte * ) FS_LoadMallocFile ( mdl , & fsize ) ;
2004-08-23 00:15:46 +00:00
if ( ! buf )
return 0 ;
2021-04-14 05:21:04 +00:00
crc = CalcHashInt ( & hash_crc16 , buf , fsize ) ;
2014-10-05 20:04:11 +00:00
BZ_Free ( buf ) ;
2004-08-23 00:15:46 +00:00
return crc ;
}
void SV_UnspawnServer ( void ) //terminate the running server.
{
int i ;
if ( sv . state )
{
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Server ended \n " ) ;
2004-08-23 00:15:46 +00:00
SV_FinalMessage ( " Server unspawned \n " ) ;
2022-06-19 15:17:54 +00:00
PR_PreShutdown ( ) ;
2021-07-03 01:46:58 +00:00
# ifdef SUBSERVERS
if ( sv . state = = ss_clustermode & & svs . allocated_client_slots = = 1 )
MSV_Shutdown ( ) ;
# endif
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
2011-08-16 04:12:15 +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
2011-08-16 04:12:15 +00:00
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
{
if ( svs . clients [ i ] . state )
------------------------------------------------------------------------
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
SV_DropClient ( & svs . clients [ i ] ) ;
2004-08-23 00:15:46 +00:00
}
2011-12-23 03:12:29 +00:00
PR_Deinit ( ) ;
2014-03-30 08:55:06 +00:00
# ifdef Q3SERVER
2022-03-08 05:31:34 +00:00
if ( q3 )
q3 - > sv . ShutdownGame ( false ) ;
2014-03-30 08:55:06 +00:00
# endif
2005-03-18 06:13:11 +00:00
# ifdef Q2SERVER
SVQ2_ShutdownGameProgs ( ) ;
2015-05-03 19:57:46 +00:00
SVQ2_Ents_Shutdown ( ) ;
2009-03-03 01:52:30 +00:00
# endif
# ifdef HLSERVER
SVHL_ShutdownGame ( ) ;
2014-03-30 08:55:06 +00:00
# endif
# ifdef VM_Q1
2017-10-12 12:02:25 +00:00
Q1QVM_Shutdown ( true ) ;
2005-03-18 06:13:11 +00:00
# endif
2009-11-04 21:16:50 +00:00
sv . world . worldmodel = NULL ;
2004-08-23 00:15:46 +00:00
sv . state = ss_dead ;
2013-04-04 08:08:49 +00:00
if ( sv . csqcentversion )
{
BZ_Free ( sv . csqcentversion ) ;
sv . csqcentversion = NULL ;
}
2004-08-23 00:15:46 +00:00
}
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
2004-08-23 00:15:46 +00:00
{
2010-07-12 22:46:37 +00:00
if ( svs . clients [ i ] . frameunion . frames )
Z_Free ( svs . clients [ i ] . frameunion . frames ) ;
svs . clients [ i ] . frameunion . frames = NULL ;
2016-07-12 00:40:13 +00:00
svs . clients [ i ] . pendingdeltabits = NULL ;
svs . clients [ i ] . pendingcsqcbits = NULL ;
2004-08-23 00:15:46 +00:00
svs . clients [ i ] . state = 0 ;
2005-05-19 02:53:03 +00:00
* svs . clients [ i ] . namebuf = ' \0 ' ;
svs . clients [ i ] . name = NULL ;
2018-07-05 16:21:44 +00:00
InfoBuf_Clear ( & svs . clients [ i ] . userinfo , true ) ;
2004-08-23 00:15:46 +00:00
}
2013-10-29 17:38:22 +00:00
free ( svs . clients ) ;
svs . clients = NULL ;
svs . allocated_client_slots = 0 ;
2018-08-04 07:05:20 +00:00
# ifdef SAVEDGAMES
2012-02-12 05:18:31 +00:00
SV_FlushLevelCache ( ) ;
2018-08-04 07:05:20 +00:00
# endif
2004-08-23 00:15:46 +00:00
NET_CloseServer ( ) ;
2015-02-02 08:01:53 +00:00
SV_RunCmdCleanup ( ) ;
2004-08-23 00:15:46 +00:00
}
2013-10-29 17:38:22 +00:00
void SV_UpdateMaxPlayers ( int newmax )
{
int i ;
if ( newmax ! = svs . allocated_client_slots )
{
2014-06-30 21:57:35 +00:00
client_t * old = svs . clients ;
2013-10-29 17:38:22 +00:00
for ( i = newmax ; i < svs . allocated_client_slots ; i + + )
{
if ( svs . clients [ i ] . state )
SV_DropClient ( & svs . clients [ i ] ) ;
svs . clients [ i ] . namebuf [ 0 ] = ' \0 ' ; //kill all bots
}
if ( newmax )
svs . clients = realloc ( svs . clients , newmax * sizeof ( * svs . clients ) ) ;
else
{
free ( svs . clients ) ;
svs . clients = NULL ;
}
for ( i = svs . allocated_client_slots ; i < newmax ; i + + )
{
memset ( & svs . clients [ i ] , 0 , sizeof ( svs . clients [ i ] ) ) ;
svs . clients [ i ] . name = svs . clients [ i ] . namebuf ;
svs . clients [ i ] . team = svs . clients [ i ] . teambuf ;
}
2014-06-30 21:57:35 +00:00
for ( i = 0 ; i < min ( newmax , svs . allocated_client_slots ) ; i + + )
{
2020-04-19 01:23:32 +00:00
if ( svs . clients [ i ] . name = = old [ i ] . namebuf )
svs . clients [ i ] . name = svs . clients [ i ] . namebuf ;
if ( svs . clients [ i ] . team = = old [ i ] . teambuf )
svs . clients [ i ] . team = svs . clients [ i ] . teambuf ;
2014-06-30 21:57:35 +00:00
if ( svs . clients [ i ] . netchan . message . data )
svs . clients [ i ] . netchan . message . data = ( qbyte * ) & svs . clients [ i ] + ( svs . clients [ i ] . netchan . message . data - ( qbyte * ) & old [ i ] ) ;
if ( svs . clients [ i ] . datagram . data )
svs . clients [ i ] . datagram . data = ( qbyte * ) & svs . clients [ i ] + ( svs . clients [ i ] . datagram . data - ( qbyte * ) & old [ i ] ) ;
if ( svs . clients [ i ] . backbuf . data )
svs . clients [ i ] . backbuf . data = ( qbyte * ) & svs . clients [ i ] + ( svs . clients [ i ] . backbuf . data - ( qbyte * ) & old [ i ] ) ;
if ( svs . clients [ i ] . controlled )
svs . clients [ i ] . controlled = svs . clients + ( svs . clients [ i ] . controlled - old ) ;
if ( svs . clients [ i ] . controller )
svs . clients [ i ] . controller = svs . clients + ( svs . clients [ i ] . controller - old ) ;
}
2013-10-29 17:38:22 +00:00
svs . allocated_client_slots = sv . allocated_client_slots = newmax ;
2018-07-05 16:21:44 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
{
InfoSync_Clear ( & svs . clients [ i ] . infosync ) ;
svs . clients [ i ] . userinfo . ChangeCB = svs . info . ChangeCB ;
svs . clients [ i ] . userinfo . ChangeCTX = & svs . clients [ i ] . userinfo ;
}
2013-10-29 17:38:22 +00:00
}
sv . allocated_client_slots = svs . allocated_client_slots ;
}
2014-09-02 02:44:43 +00:00
void SV_SetupNetworkBuffers ( qboolean bigcoords )
2013-12-29 22:48:28 +00:00
{
int i ;
//determine basic primitive sizes.
2021-07-06 00:11:58 +00:00
svs . netprim . flags = 0 ;
2013-12-29 22:48:28 +00:00
if ( bigcoords )
{
2021-07-06 00:11:58 +00:00
if ( svs . netprim . coordtype & & svs . netprim . coordtype ! = COORDTYPE_FLOAT_32 )
Con_Printf ( " Switching to big coords \n " ) ;
2019-10-14 02:36:57 +00:00
svs . netprim . coordtype = COORDTYPE_FLOAT_32 ;
2013-12-29 22:48:28 +00:00
svs . netprim . anglesize = 2 ;
}
else
{
2021-07-06 00:11:58 +00:00
if ( svs . netprim . coordtype & & svs . netprim . coordtype ! = COORDTYPE_FIXED_13_3 )
Con_Printf ( " Switching to classic coords \n " ) ;
2019-10-14 02:36:57 +00:00
svs . netprim . coordtype = COORDTYPE_FIXED_13_3 ;
2013-12-29 22:48:28 +00:00
svs . netprim . anglesize = 1 ;
}
//FIXME: this should be part of sv_new_f or something instead, so that any angles sent by clients won't be invalid
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
{
2019-04-20 16:55:12 +00:00
svs . clients [ i ] . netchan . netprim = svs . netprim ;
2023-09-11 09:31:09 +00:00
if ( svs . clients [ i ] . protocol = = SCP_QUAKE2EX )
svs . clients [ i ] . netchan . netprim . coordtype = COORDTYPE_FLOAT_32 ; //forced to floats. we have multiple multicast buffers. woo.
2019-04-20 16:55:12 +00:00
//make sure those are kept up to date too.
svs . clients [ i ] . datagram . prim =
2021-08-14 04:04:15 +00:00
svs . clients [ i ] . netchan . message . prim =
svs . clients [ i ] . backbuf . prim = svs . clients [ i ] . netchan . netprim ;
2013-12-29 22:48:28 +00:00
}
//
sv . datagram . maxsize = sizeof ( sv . datagram_buf ) ;
sv . datagram . data = sv . datagram_buf ;
sv . datagram . allowoverflow = true ;
sv . datagram . prim = svs . netprim ;
sv . reliable_datagram . maxsize = sizeof ( sv . reliable_datagram_buf ) ;
sv . reliable_datagram . data = sv . reliable_datagram_buf ;
sv . reliable_datagram . prim = svs . netprim ;
sv . multicast . maxsize = sizeof ( sv . multicast_buf ) ;
sv . multicast . data = sv . multicast_buf ;
sv . multicast . prim = svs . netprim ;
# ifdef NQPROT
sv . nqdatagram . maxsize = sizeof ( sv . nqdatagram_buf ) ;
sv . nqdatagram . data = sv . nqdatagram_buf ;
sv . nqdatagram . allowoverflow = true ;
sv . nqdatagram . prim = svs . netprim ;
sv . nqreliable_datagram . maxsize = sizeof ( sv . nqreliable_datagram_buf ) ;
sv . nqreliable_datagram . data = sv . nqreliable_datagram_buf ;
sv . nqreliable_datagram . prim = svs . netprim ;
sv . nqmulticast . maxsize = sizeof ( sv . nqmulticast_buf ) ;
sv . nqmulticast . data = sv . nqmulticast_buf ;
sv . nqmulticast . prim = svs . netprim ;
# endif
# ifdef Q2SERVER
2023-09-11 09:31:09 +00:00
sv . q2multicast [ 0 ] . maxsize = sizeof ( sv . q2multicast_lcbuf ) ;
sv . q2multicast [ 0 ] . data = sv . q2multicast_lcbuf ;
sv . q2multicast [ 0 ] . prim = svs . netprim ;
sv . q2multicast [ 1 ] . maxsize = sizeof ( sv . q2multicast_bcbuf ) ;
sv . q2multicast [ 1 ] . data = sv . q2multicast_bcbuf ;
sv . q2multicast [ 1 ] . prim = svs . netprim ;
sv . q2multicast [ 1 ] . prim . coordtype = COORDTYPE_FLOAT_32 ;
2013-12-29 22:48:28 +00:00
# endif
sv . master . maxsize = sizeof ( sv . master_buf ) ;
sv . master . data = sv . master_buf ;
sv . master . prim = msg_nullnetprim ;
2019-09-17 19:49:39 +00:00
sv . signon . data = sv . signon_buffer + 2 ;
sv . used_signon_space = 0 ;
2013-12-29 22:48:28 +00:00
sv . signon . prim = svs . netprim ;
2019-09-17 19:49:39 +00:00
sv . signon . maxsize = sizeof ( sv . signon_buffer ) - sv . used_signon_space ;
2013-12-29 22:48:28 +00:00
}
2016-01-18 05:22:07 +00:00
void SV_WipeServerState ( void )
{
if ( sv . stringsalloced )
{
unsigned int i ;
2016-02-15 06:01:17 +00:00
char * * ptrs = ( char * * ) & sv . strings ;
2016-01-18 05:22:07 +00:00
for ( i = 0 ; i < sizeof ( sv . strings ) / sizeof ( sv . strings . ptrs [ 0 ] ) ; i + + )
2016-02-15 06:01:17 +00:00
Z_Free ( ptrs [ i ] ) ;
2016-01-18 05:22:07 +00:00
}
2019-07-02 04:12:20 +00:00
# ifdef SQL
SQL_KillServers ( & sv ) ;
# endif
2016-01-18 05:22:07 +00:00
memset ( & sv , 0 , sizeof ( sv ) ) ;
sv . logindatabase = - 1 ;
}
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = =
SV_SpawnServer
Change the server to a new map , taking all connected
clients along with it .
This is only called from the SV_Map_f ( ) function .
= = = = = = = = = = = = = = = =
*/
2020-04-19 01:23:32 +00:00
void SV_SpawnServer ( const char * server , const char * startspot , qboolean noents , qboolean usecinematic , int playerslots )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
extern cvar_t allow_download_refpackages ;
2004-08-23 00:15:46 +00:00
func_t f ;
2020-05-14 15:50:26 +00:00
const char * file , * csprogsname ;
2004-08-23 00:15:46 +00:00
2005-05-15 18:49:04 +00:00
gametype_e newgametype ;
2005-03-07 08:58:26 +00:00
2004-08-23 00:15:46 +00:00
edict_t * ent ;
# ifdef Q2SERVER
q2edict_t * q2ent ;
# endif
2005-09-14 04:39:36 +00:00
int i , j ;
2010-08-14 03:17:33 +00:00
extern int sv_allow_cheats ;
2014-10-05 20:04:11 +00:00
size_t fsz ;
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
2010-02-06 01:25:04 +00:00
if ( ! isDedicated & & qrenderer = = QR_NONE )
2004-08-23 00:15:46 +00:00
{
2004-09-20 23:25:38 +00:00
R_RestartRenderer_f ( ) ;
2007-05-25 22:16:29 +00:00
2010-02-06 01:25:04 +00:00
if ( qrenderer = = QR_NONE )
2007-05-25 22:16:29 +00:00
{
Sys_Error ( " No renderer set when map restarted \n " ) ;
return ;
}
2004-08-23 00:15:46 +00:00
}
# endif
Con_DPrintf ( " SpawnServer: %s \n " , server ) ;
# ifndef SERVERONLY
total_loading_size = 100 ;
current_loading_size = 0 ;
2009-04-06 00:34:32 +00:00
SCR_SetLoadingStage ( LS_SERVER ) ;
2006-09-17 00:59:22 +00:00
// SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2004-08-23 00:15:46 +00:00
# endif
2022-06-19 15:17:54 +00:00
PR_PreShutdown ( ) ;
svs . spawncount + + ; // any partially connected client will be restarted
sv . world . spawncount = svs . spawncount ;
2004-08-23 00:15:46 +00:00
sv . state = ss_dead ;
if ( sv . gamedirchanged )
{
sv . gamedirchanged = false ;
# ifndef SERVERONLY
Wads_Flush ( ) ; //server code is responsable for flushing old state
# endif
2005-11-03 23:40:51 +00:00
# ifdef SVRANKING
2004-08-23 00:15:46 +00:00
Rank_Flush ( ) ;
2005-11-03 23:40:51 +00:00
# endif
2004-08-23 00:15:46 +00:00
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
2004-08-23 00:15:46 +00:00
{
2015-09-01 04:45:15 +00:00
# ifdef SVRANKING
2005-05-26 12:55:34 +00:00
if ( svs . clients [ i ] . state & & ISQWCLIENT ( & svs . clients [ i ] ) )
2004-08-23 00:15:46 +00:00
ReloadRanking ( & svs . clients [ i ] , svs . clients [ i ] . name ) ;
2015-09-01 04:45:15 +00:00
# endif
2004-08-23 00:15:46 +00:00
if ( svs . clients [ i ] . spawninfo ) //don't remember this stuff.
Z_Free ( svs . clients [ i ] . spawninfo ) ;
svs . clients [ i ] . spawninfo = NULL ;
}
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
2004-08-23 00:15:46 +00:00
T_FreeStrings ( ) ;
2014-09-17 03:04:08 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
2004-08-23 00:15:46 +00:00
{
svs . clients [ i ] . nextservertimeupdate = 0 ;
if ( ! svs . clients [ i ] . state ) //bots with the net_preparse module.
2018-07-05 16:21:44 +00:00
InfoBuf_Clear ( & svs . clients [ i ] . userinfo , true ) ; //clear the userinfo to clear the name
2004-11-17 17:49:18 +00:00
if ( svs . clients [ i ] . netchan . remote_address . type = = NA_LOOPBACK )
{ //forget this client's message buffers, so that any shared client/server network state persists (eg: float coords)
svs . clients [ i ] . num_backbuf = 0 ;
svs . clients [ i ] . datagram . cursize = 0 ;
}
2005-08-03 23:14:59 +00:00
svs . clients [ i ] . csqcactive = false ;
2004-08-23 00:15:46 +00:00
}
VoteFlushAll ( ) ;
# ifndef SERVERONLY
cl . worldmodel = NULL ;
2006-01-28 19:04:13 +00:00
r_worldentity . model = NULL ;
2018-08-23 06:03:31 +00:00
// if (0)
// cls.state = ca_connected;
2014-10-05 20:04:11 +00:00
Surf_PreNewMap ( ) ;
2004-08-23 00:15:46 +00:00
# endif
2005-09-08 22:52:46 +00:00
# ifdef Q3SERVER
2005-10-05 02:26:54 +00:00
if ( svs . gametype = = GT_QUAKE3 )
2022-03-08 05:31:34 +00:00
q3 - > sv . ShutdownGame ( false ) ; //botlib kinda mandates this. :(
2005-09-08 22:52:46 +00:00
# endif
2004-08-23 00:15:46 +00:00
Mod_ClearAll ( ) ;
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
# ifndef SERVERONLY
r_regsequence + + ;
# endif
2004-08-23 00:15:46 +00:00
2012-11-29 13:37:48 +00:00
PR_Deinit ( ) ;
2009-11-12 08:53:10 +00:00
2013-04-04 08:08:49 +00:00
if ( sv . csqcentversion )
BZ_Free ( sv . csqcentversion ) ;
2004-08-23 00:15:46 +00:00
// wipe the entire per-level structure
2016-01-18 05:22:07 +00:00
SV_WipeServerState ( ) ;
2004-08-23 00:15:46 +00:00
2013-12-29 22:48:28 +00:00
SV_SetupNetworkBuffers ( sv_bigcoords . ival ) ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
if ( allow_download_refpackages . ival )
FS_ReferenceControl ( 1 , 1 ) ;
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
Q_strncpyz ( svs . name , server , sizeof ( svs . name ) ) ;
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
//SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " map " ) ;
# else
# define SCR_SetLoadingFile(s)
2004-08-23 00:15:46 +00:00
# endif
2021-04-14 05:21:04 +00:00
Cvar_ApplyLatches ( CVAR_MAPLATCH , false ) ;
2004-08-23 00:15:46 +00:00
2005-08-07 18:08:13 +00:00
//work out the gamespeed
//reset the server time.
2012-02-12 05:18:31 +00:00
sv . time = 0.01 ; //some progs don't like time starting at 0.
2004-08-23 00:15:46 +00:00
//cos of spawn funcs like self.nextthink = time...
2010-07-25 15:07:19 +00:00
//NQ uses 1, QW uses 0. Awkward.
2005-08-07 18:08:13 +00:00
sv . starttime = Sys_DoubleTime ( ) ;
2004-08-23 00:15:46 +00:00
COM_FlushTempoaryPacks ( ) ;
2010-08-14 03:17:33 +00:00
if ( sv_cheats . ival )
2006-03-11 03:12:10 +00:00
{
sv_allow_cheats = true ;
2018-07-05 16:21:44 +00:00
InfoBuf_SetStarKey ( & svs . info , " *cheats " , " ON " ) ;
2006-03-11 03:12:10 +00:00
}
else
{
2010-08-14 03:17:33 +00:00
sv_allow_cheats = 2 ;
2018-07-05 16:21:44 +00:00
InfoBuf_SetStarKey ( & svs . info , " *cheats " , " " ) ;
2006-03-11 03:12:10 +00:00
}
2006-03-11 04:39:16 +00:00
# ifndef SERVERONLY
2010-08-14 03:17:33 +00:00
//This fixes a bug where the server advertises cheats, the internal client connects, and doesn't think cheats are allowed.
2014-03-30 08:55:06 +00:00
//this applies to anything that can affect the content that is loaded by the server, but cheats is the only special one (because of the *)
2018-07-05 16:21:44 +00:00
InfoBuf_Clone ( & cl . serverinfo , & svs . info ) ;
2012-09-30 05:52:03 +00:00
if ( ! isDedicated )
CL_CheckServerInfo ( ) ;
2006-03-11 03:12:10 +00:00
# endif
2013-03-12 22:53:23 +00:00
sv . state = ss_loading ;
2013-07-14 12:22:51 +00:00
# if defined(Q2BSPS)
2004-08-23 00:15:46 +00:00
if ( usecinematic )
{
2014-12-11 16:26:26 +00:00
qboolean QDECL Mod_LoadQ2BrushModel ( model_t * mod , void * buffer , size_t fsize ) ;
2013-03-12 22:53:23 +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
Q_strncpyz ( svs . name , server , sizeof ( svs . name ) ) ;
2014-06-30 21:57:35 +00:00
Q_strncpyz ( sv . modelname , " " , sizeof ( sv . modelname ) ) ;
2013-03-12 22:53:23 +00:00
2014-10-05 20:04:11 +00:00
sv . world . worldmodel = Mod_FindName ( sv . modelname ) ;
2014-12-11 16:26:26 +00:00
if ( Mod_LoadQ2BrushModel ( sv . world . worldmodel , NULL , 0 ) )
2014-10-05 20:04:11 +00:00
sv . world . worldmodel - > loadstate = MLS_LOADED ;
else
sv . world . worldmodel - > loadstate = MLS_FAILED ;
2004-08-23 00:15:46 +00:00
}
else
2013-07-14 12:22:51 +00:00
# endif
2004-08-23 00:15:46 +00:00
{
2015-04-14 23:12:17 +00:00
//.map is commented out because quite frankly, they're a bit annoying when the engine loads the gpled start.map when really you wanted to just play the damn game intead of take it apart.
//if you want to load a .map, just use 'map foo.map' instead.
2024-04-06 00:05:33 +00:00
char * exts [ ] = { " %s " , " maps/%s " , " maps/%s.bsp " , " maps/%s.d3dbsp " , " maps/%s.cm " , " maps/%s.hmp " , /*"maps/%s.map",*/ " maps/%s.bsp.gz " , " maps/%s.bsp.xz " , NULL } , * e ;
2023-02-20 05:50:50 +00:00
int depth , bestdepth = FDEPTH_MISSING ;
2017-05-23 07:03:07 +00:00
flocation_t loc ;
time_t filetime ;
2023-02-20 05:50:50 +00:00
char * mod = NULL ;
2024-05-03 16:52:58 +00:00
Q_snprintfz ( sv . modelname , sizeof ( sv . modelname ) , exts [ 1 ] , server ) ; // `map foo.map` can bypass earlier checks, so don't get too screwed up by that.
2023-01-09 05:12:39 +00:00
if ( bestdepth = = FDEPTH_MISSING )
{ //not an exact name, scan the maps subdir.
for ( i = 0 ; exts [ i ] ; i + + )
2014-06-16 16:21:28 +00:00
{
2023-01-09 05:12:39 +00:00
depth = COM_FDepthFile ( va ( exts [ i ] , server ) , false ) ;
if ( depth < bestdepth )
{
bestdepth = depth ;
Q_snprintfz ( sv . modelname , sizeof ( sv . modelname ) , exts [ i ] , server ) ;
}
2014-06-16 16:21:28 +00:00
}
2011-05-20 04:10:46 +00:00
}
2023-02-20 05:50:50 +00:00
if ( bestdepth = = FDEPTH_MISSING )
{
mod = strchr ( server , ' # ' ) ;
if ( mod )
{
* mod = 0 ;
bestdepth = COM_FDepthFile ( server , false ) ;
if ( bestdepth ! = FDEPTH_MISSING )
Q_snprintfz ( sv . modelname , sizeof ( sv . modelname ) , " %s " , server ) ;
else
{ //not an exact name, scan the maps subdir.
for ( i = 0 ; exts [ i ] ; i + + )
{
depth = COM_FDepthFile ( va ( exts [ i ] , server ) , false ) ;
if ( depth < bestdepth )
{
bestdepth = depth ;
Q_snprintfz ( sv . modelname , sizeof ( sv . modelname ) , exts [ i ] , server ) ;
}
}
}
* mod = ' # ' ;
if ( bestdepth = = FDEPTH_MISSING )
mod = NULL ;
}
}
2023-01-09 05:12:39 +00:00
if ( ! strncmp ( sv . modelname , " maps/ " , 5 ) )
Q_strncpyz ( svs . name , sv . modelname + 5 , sizeof ( svs . name ) ) ;
else
Q_strncpyz ( svs . name , sv . modelname , sizeof ( svs . name ) ) ;
e = ( char * ) COM_GetFileExtension ( svs . name , NULL ) ;
if ( ! strcmp ( e , " .gz " ) | | ! strcmp ( e , " .xz " ) )
{
* e = 0 ;
e = ( char * ) COM_GetFileExtension ( svs . name , NULL ) ;
}
if ( ! strcmp ( e , " .bsp " ) )
* e = 0 ;
2023-02-20 05:50:50 +00:00
Mod_SetModifier ( mod ) ;
2014-03-30 08:55:06 +00:00
sv . world . worldmodel = Mod_ForName ( sv . modelname , MLV_ERROR ) ;
2017-05-23 07:03:07 +00:00
if ( FS_FLocateFile ( sv . modelname , FSLF_IFFOUND , & loc ) & & FS_GetLocMTime ( & loc , & filetime ) )
{
2017-08-29 02:29:06 +00:00
if ( filetime > sv . world . worldmodel - > mtime & & sv . world . worldmodel - > mtime )
2017-05-23 07:03:07 +00:00
{
COM_WorkerFullSync ( ) ; //sync all the workers, just in case.
Mod_PurgeModel ( sv . world . worldmodel , MP_RESET ) ; //nuke it now
sv . world . worldmodel = Mod_ForName ( sv . modelname , MLV_ERROR ) ; //and we can reload it now
}
sv . world . worldmodel - > mtime = filetime ;
}
2021-04-14 05:21:04 +00:00
if ( ! sv . world . worldmodel | | sv . world . worldmodel - > loadstate ! = MLS_LOADED )
Sys_Error ( " \" %s \" is missing or corrupt \n " , sv . modelname ) ;
// if (sv.world.worldmodel->type != mod_brush && sv.world.worldmodel->type != mod_heightmap)
if ( ! sv . world . worldmodel - > funcs . NativeTrace & & ! sv . world . worldmodel - > funcs . PointContents )
Sys_Error ( " \" %s \" is not a bsp model \n " , sv . modelname ) ;
else if ( ! Mod_GetEntitiesString ( sv . world . worldmodel ) )
Sys_Error ( " \" %s \" has no entity data \n " , sv . modelname ) ;
2004-08-23 00:15:46 +00:00
}
2021-04-14 05:21:04 +00:00
2004-08-23 00:15:46 +00:00
sv . state = ss_dead ;
2021-06-01 09:23:42 +00:00
//make sure our map's package is loaded.
if ( sv . world . worldmodel )
FS_LoadMapPackFile ( sv . world . worldmodel - > name , sv . world . worldmodel - > archive ) ;
2021-11-03 20:30:40 +00:00
//reset the map's areaportal state... it might be dirty from a restart or so.
if ( sv . world . worldmodel - > funcs . LoadAreaPortalBlob )
sv . world . worldmodel - > funcs . LoadAreaPortalBlob ( sv . world . worldmodel , NULL , 0 ) ;
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
// SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " phs " ) ;
2004-08-23 00:15:46 +00:00
# endif
SV_CalcPHS ( ) ;
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
//SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " gamecode " ) ;
2004-08-23 00:15:46 +00:00
# endif
2021-04-14 05:21:04 +00:00
if ( sv . world . worldmodel - > type ! = mod_brush )
InfoBuf_SetStarKey ( & svs . info , " *bspversion " , " " ) ;
else if ( sv . world . worldmodel - > fromgame = = fg_doom )
2018-07-05 16:21:44 +00:00
InfoBuf_SetStarKey ( & svs . info , " *bspversion " , " 1 " ) ;
2009-11-04 21:16:50 +00:00
else if ( sv . world . worldmodel - > fromgame = = fg_halflife )
2018-07-05 16:21:44 +00:00
InfoBuf_SetStarKey ( & svs . info , " *bspversion " , " 30 " ) ;
2009-11-04 21:16:50 +00:00
else if ( sv . world . worldmodel - > fromgame = = fg_quake2 )
2018-07-05 16:21:44 +00:00
InfoBuf_SetStarKey ( & svs . info , " *bspversion " , " 38 " ) ;
2009-11-04 21:16:50 +00:00
else if ( sv . world . worldmodel - > fromgame = = fg_quake3 )
2018-07-05 16:21:44 +00:00
InfoBuf_SetStarKey ( & svs . info , " *bspversion " , " 46 " ) ;
2004-08-23 00:15:46 +00:00
else
2018-07-05 16:21:44 +00:00
InfoBuf_SetStarKey ( & svs . info , " *bspversion " , " " ) ;
InfoBuf_SetStarKey ( & svs . info , " *startspot " , ( startspot ? startspot : " " ) ) ;
2004-08-23 00:15:46 +00:00
//
2009-11-12 08:53:10 +00:00
// init physics interaction links
2004-08-23 00:15:46 +00:00
//
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
World_ClearWorld ( & sv . world , false ) ;
2004-08-23 00:15:46 +00:00
2005-03-10 03:55:18 +00:00
//do we allow csprogs?
# ifdef PEXT_CSQC
2014-10-05 20:04:11 +00:00
fsz = 0 ;
2020-05-14 15:50:26 +00:00
if ( noents )
csprogsname = " csaddon.dat " ;
else
csprogsname = sv_csqc_progname . string ;
if ( * csprogsname )
file = COM_LoadTempFile ( csprogsname , 0 , & fsz ) ;
2009-05-24 10:11:17 +00:00
else
file = NULL ;
2005-03-10 03:55:18 +00:00
if ( file )
{
char text [ 64 ] ;
2023-02-20 06:13:40 +00:00
sv . csqcchecksum = CalcHashInt ( & hash_md4 , file , fsz ) ;
2008-05-25 22:23:43 +00:00
sprintf ( text , " 0x%x " , sv . csqcchecksum ) ;
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForStarKey ( & svs . info , " *csprogs " , text ) ;
2015-04-14 23:12:17 +00:00
sprintf ( text , " 0x%x " , ( unsigned int ) fsz ) ;
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForStarKey ( & svs . info , " *csprogssize " , text ) ;
2020-05-14 15:50:26 +00:00
if ( strcmp ( csprogsname , " csprogs.dat " ) )
InfoBuf_SetValueForStarKey ( & svs . info , " *csprogsname " , csprogsname ) ;
2009-05-24 10:11:17 +00:00
else
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForStarKey ( & svs . info , " *csprogsname " , " " ) ;
2005-03-10 03:55:18 +00:00
}
else
2008-05-25 22:23:43 +00:00
{
sv . csqcchecksum = 0 ;
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForStarKey ( & svs . info , " *csprogs " , " " ) ;
InfoBuf_SetValueForStarKey ( & svs . info , " *csprogssize " , " " ) ;
InfoBuf_SetValueForStarKey ( & svs . info , " *csprogsname " , " " ) ;
2008-05-25 22:23:43 +00:00
}
2005-03-10 03:55:18 +00:00
# endif
2005-03-20 02:57:11 +00:00
2007-09-02 19:55:17 +00:00
if ( svs . gametype = = GT_PROGS )
2004-08-23 00:15:46 +00:00
{
2007-09-02 19:55:17 +00:00
if ( svprogfuncs ) //we don't want the q1 stuff anymore.
{
2019-09-25 20:23:24 +00:00
svprogfuncs - > Shutdown ( svprogfuncs ) ;
2009-11-04 21:16:50 +00:00
sv . world . progs = svprogfuncs = NULL ;
2007-09-02 19:55:17 +00:00
}
2004-08-23 00:15:46 +00:00
}
2005-03-07 08:58:26 +00:00
sv . state = ss_loading ;
2019-07-02 04:12:20 +00:00
MSV_OpenUserDatabase ( ) ;
2013-04-04 08:08:49 +00:00
sv . world . max_edicts = pr_maxedicts . value ;
if ( sv . world . max_edicts > MAX_EDICTS )
sv . world . max_edicts = MAX_EDICTS ;
# ifdef PEXT_CSQC
sv . csqcentversion = BZ_Malloc ( sizeof ( * sv . csqcentversion ) * sv . world . max_edicts ) ;
for ( i = 0 ; i < sv . world . max_edicts ; i + + )
sv . csqcentversion [ i ] = 1 ; //force all csqc edicts to start off as version 1
# endif
2005-05-15 18:49:04 +00:00
newgametype = svs . gametype ;
2020-05-14 15:50:26 +00:00
if ( noents )
{
newgametype = GT_PROGS ; //let's just hope this loads.
Q_InitProgs ( INITPROGS_EDITOR ) ;
}
2009-03-03 01:52:30 +00:00
# ifdef HLSERVER
2020-05-14 15:50:26 +00:00
else if ( SVHL_InitGame ( ) )
2009-03-03 01:52:30 +00:00
newgametype = GT_HALFLIFE ;
# endif
2005-03-07 08:58:26 +00:00
# ifdef Q3SERVER
2022-03-08 05:31:34 +00:00
else if ( q3 & & q3 - > sv . InitGame ( & svs , & sv , false ) )
2005-05-15 18:49:04 +00:00
newgametype = GT_QUAKE3 ;
2005-03-07 08:58:26 +00:00
# endif
2004-08-23 00:15:46 +00:00
# ifdef Q2SERVER
2021-11-03 20:30:40 +00:00
else if ( ( sv . world . worldmodel - > fromgame = = fg_quake2 | | sv . world . worldmodel - > fromgame = = fg_quake3 ) & & sv . world . worldmodel - > funcs . AreasConnected & & ! * pr_ssqc_progs . string & & SVQ2_InitGameProgs ( ) ) //these are the rules for running a q2 server
2005-05-15 18:49:04 +00:00
newgametype = GT_QUAKE2 ; //we loaded the dll
2007-09-02 19:55:17 +00:00
# endif
2014-03-30 08:55:06 +00:00
# ifdef VM_LUA
2020-05-14 15:50:26 +00:00
else if ( PR_LoadLua ( ) )
2014-03-30 08:55:06 +00:00
newgametype = GT_LUA ;
# endif
2007-09-02 19:55:17 +00:00
# ifdef VM_Q1
2020-05-14 15:50:26 +00:00
else if ( PR_LoadQ1QVM ( ) )
2007-09-02 19:55:17 +00:00
newgametype = GT_Q1QVM ;
2004-08-23 00:15:46 +00:00
# endif
2020-05-14 15:50:26 +00:00
else
2004-08-23 00:15:46 +00:00
{
2005-05-15 18:49:04 +00:00
newgametype = GT_PROGS ; //let's just hope this loads.
2020-05-14 15:50:26 +00:00
Q_InitProgs ( usecinematic ? INITPROGS_REQUIRE : INITPROGS_NORMAL ) ;
2005-03-07 08:58:26 +00:00
}
2004-08-23 00:15:46 +00:00
2005-03-07 08:58:26 +00:00
// if ((sv.worldmodel->fromgame == fg_quake2 || sv.worldmodel->fromgame == fg_quake3) && !*progs.string && SVQ2_InitGameProgs()) //full q2 dll decision in one if statement
2005-05-15 18:49:04 +00:00
if ( newgametype ! = svs . gametype )
2005-03-07 08:58:26 +00:00
{
2009-03-03 01:52:30 +00:00
# ifdef HLSERVER
2011-04-20 03:34:32 +00:00
if ( newgametype ! = GT_HALFLIFE )
SVHL_ShutdownGame ( ) ;
2009-03-03 01:52:30 +00:00
# endif
2005-05-15 18:49:04 +00:00
# ifdef Q3SERVER
2022-03-08 06:20:33 +00:00
if ( newgametype ! = GT_QUAKE3 & & q3 )
2022-03-08 05:31:34 +00:00
q3 - > sv . ShutdownGame ( false ) ;
2005-05-15 18:49:04 +00:00
# endif
# ifdef Q2SERVER
2011-04-20 03:34:32 +00:00
if ( newgametype ! = GT_QUAKE2 ) //we don't want the q2 stuff anymore.
SVQ2_ShutdownGameProgs ( ) ;
2005-05-15 18:49:04 +00:00
# endif
2007-09-02 19:55:17 +00:00
# ifdef VM_Q1
2011-04-20 03:34:32 +00:00
if ( newgametype ! = GT_Q1QVM )
2017-10-12 12:02:25 +00:00
Q1QVM_Shutdown ( true ) ;
2007-09-02 19:55:17 +00:00
# endif
2005-05-15 18:49:04 +00:00
2013-10-29 17:38:22 +00:00
SV_UpdateMaxPlayers ( 0 ) ;
2011-04-20 03:34:32 +00:00
}
svs . gametype = newgametype ;
2018-06-02 08:55:57 +00:00
Cvar_ForceCallback ( & sv_nqplayerphysics ) ;
2004-08-23 00:15:46 +00:00
2009-11-07 13:29:15 +00:00
sv . models [ 1 ] = sv . world . worldmodel ;
2007-09-03 22:37:13 +00:00
# ifdef VM_Q1
if ( svs . gametype = = GT_Q1QVM )
{
2014-09-17 03:04:08 +00:00
int subs ;
2016-01-18 05:22:07 +00:00
sv . strings . sound_precache [ 0 ] = " " ;
2007-09-03 22:37:13 +00:00
sv . strings . model_precache [ 0 ] = " " ;
2014-09-17 03:04:08 +00:00
subs = sv . world . worldmodel - > numsubmodels ;
if ( subs > MAX_PRECACHE_MODELS - 2 )
{
Con_Printf ( " Warning: worldmodel has too many submodels \n " ) ;
subs = MAX_PRECACHE_MODELS - 2 ;
}
2007-09-03 22:37:13 +00:00
sv . strings . model_precache [ 1 ] = sv . modelname ; //the qvm doesn't have access to this array
2014-09-17 03:04:08 +00:00
for ( i = 1 ; i < subs ; i + + )
2007-09-03 22:37:13 +00:00
{
2014-09-17 03:04:08 +00:00
char * z , * s = va ( " *%u " , i ) ;
z = Z_TagMalloc ( strlen ( s ) + 1 , VMFSID_Q1QVM ) ;
strcpy ( z , s ) ;
sv . strings . model_precache [ 1 + i ] = z ;
2014-10-05 20:04:11 +00:00
sv . models [ i + 1 ] = Mod_ForName ( Mod_FixName ( z , sv . modelname ) , MLV_WARN ) ;
2007-09-03 22:37:13 +00:00
}
//check player/eyes models for hacks
sv . model_player_checksum = SV_CheckModel ( " progs/player.mdl " ) ;
sv . eyes_player_checksum = SV_CheckModel ( " progs/eyes.mdl " ) ;
}
else
# endif
2014-03-30 08:55:06 +00:00
if ( svs . gametype = = GT_PROGS
# ifdef VM_LUA
| | svs . gametype = = GT_LUA
# endif
)
2005-03-20 02:57:11 +00:00
{
2014-09-17 03:04:08 +00:00
int subs ;
2016-01-18 05:22:07 +00:00
sv . strings . model_precache [ 0 ] = PR_AddString ( svprogfuncs , " " , 0 , false ) ;
2013-11-21 23:02:28 +00:00
sv . strings . model_precache [ 1 ] = PR_AddString ( svprogfuncs , sv . modelname , 0 , false ) ;
2014-09-17 03:04:08 +00:00
subs = sv . world . worldmodel - > numsubmodels ;
if ( subs > MAX_PRECACHE_MODELS - 2 )
2005-03-20 02:57:11 +00:00
{
2014-09-17 03:04:08 +00:00
Con_Printf ( " Warning: worldmodel has too many submodels \n " ) ;
subs = MAX_PRECACHE_MODELS - 2 ;
}
for ( i = 1 ; i < subs ; i + + )
{
sv . strings . model_precache [ 1 + i ] = PR_AddString ( svprogfuncs , va ( " *%u " , i ) , 0 , false ) ;
2014-10-05 20:04:11 +00:00
sv . models [ i + 1 ] = Mod_ForName ( Mod_FixName ( sv . strings . model_precache [ 1 + i ] , sv . modelname ) , MLV_WARN ) ;
2005-03-20 02:57:11 +00:00
}
//check player/eyes models for hacks
sv . model_player_checksum = SV_CheckModel ( " progs/player.mdl " ) ;
sv . eyes_player_checksum = SV_CheckModel ( " progs/eyes.mdl " ) ;
}
2005-07-03 15:16:20 +00:00
# ifdef Q2SERVER
2005-03-20 02:57:11 +00:00
else if ( svs . gametype = = GT_QUAKE2 )
{
2014-09-17 03:04:08 +00:00
int subs ;
2006-04-08 05:43:53 +00:00
extern cvar_t sv_airaccelerate ;
2016-01-18 05:22:07 +00:00
sv . stringsalloced = true ;
memset ( & sv . strings , 0 , sizeof ( sv . strings ) ) ;
2006-04-08 05:43:53 +00:00
if ( deathmatch . value )
2021-07-17 15:11:15 +00:00
sv . strings . configstring [ Q2CS_AIRACCEL ] = Z_StrDupf ( " %g " , sv_airaccelerate . value ) ;
2006-04-08 05:43:53 +00:00
else
2016-01-18 05:22:07 +00:00
sv . strings . configstring [ Q2CS_AIRACCEL ] = Z_StrDup ( " 0 " ) ;
2006-04-08 05:43:53 +00:00
// init map checksum config string but only for Q2/Q3 maps
2023-09-11 09:31:09 +00:00
sv . strings . configstring [ Q2CS_MAPCHECKSUM ] = Z_StrDupf ( " %i %i " , sv . world . worldmodel - > checksum , sv . world . worldmodel - > checksum2 ) ;
2006-04-08 05:43:53 +00:00
2014-09-17 03:04:08 +00:00
subs = sv . world . worldmodel - > numsubmodels ;
2016-01-18 05:22:07 +00:00
if ( subs > MAX_PRECACHE_MODELS - 1 )
2014-09-17 03:04:08 +00:00
{
Con_Printf ( " Warning: worldmodel has too many submodels \n " ) ;
2016-01-18 05:22:07 +00:00
subs = MAX_PRECACHE_MODELS - 1 ;
2014-09-17 03:04:08 +00:00
}
2016-01-18 05:22:07 +00:00
sv . strings . configstring [ Q2CS_MODELS + 1 ] = Z_StrDup ( sv . modelname ) ;
for ( i = 1 ; i < subs & & i < Q2MAX_MODELS - 2 ; i + + )
2005-03-20 02:57:11 +00:00
{
2021-07-17 15:11:15 +00:00
sv . strings . configstring [ Q2CS_MODELS + 1 + i ] = Z_StrDupf ( " *%u " , i ) ;
2014-10-05 20:04:11 +00:00
sv . models [ i + 1 ] = Mod_ForName ( Mod_FixName ( sv . strings . configstring [ Q2CS_MODELS + 1 + i ] , sv . modelname ) , MLV_WARN ) ;
2005-03-20 02:57:11 +00:00
}
2016-01-18 05:22:07 +00:00
for ( ; i < subs ; i + + )
{
2021-07-17 15:11:15 +00:00
sv . strings . q2_extramodels [ 1 + i ] = Z_StrDupf ( " *%u " , i ) ;
2016-01-18 05:22:07 +00:00
sv . models [ i + 1 ] = Mod_ForName ( Mod_FixName ( sv . strings . q2_extramodels [ 1 + i ] , sv . modelname ) , MLV_WARN ) ;
}
2005-03-20 02:57:11 +00:00
}
2005-07-03 15:16:20 +00:00
# endif
2005-03-20 02:57:11 +00:00
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
//SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " clients " ) ;
2004-08-23 00:15:46 +00:00
# endif
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < svs . allocated_client_slots ; i + + )
2005-05-17 02:36:54 +00:00
{
2017-08-14 16:38:44 +00:00
svs . clients [ i ] . spawned = false ;
2012-02-12 05:18:31 +00:00
svs . clients [ i ] . edict = NULL ;
2005-05-17 02:36:54 +00:00
svs . clients [ i ] . name = svs . clients [ i ] . namebuf ;
svs . clients [ i ] . team = svs . clients [ i ] . teambuf ;
2018-07-05 16:21:44 +00:00
InfoSync_Clear ( & svs . clients [ i ] . infosync ) ; //we'll mark all the info as dirty at some point while connecting.
2005-05-17 02:36:54 +00:00
}
2005-03-07 08:58:26 +00:00
switch ( svs . gametype )
2004-08-23 00:15:46 +00:00
{
2013-12-29 22:48:28 +00:00
default :
SV_Error ( " bad gametype " ) ;
2007-08-07 19:16:32 +00:00
break ;
2014-03-30 08:55:06 +00:00
# ifdef VM_LUA
case GT_LUA :
# endif
2007-09-02 19:55:17 +00:00
case GT_Q1QVM :
2005-03-07 08:58:26 +00:00
case GT_PROGS :
2018-04-06 17:21:15 +00:00
ent = EDICT_NUM_PB ( svprogfuncs , 0 ) ;
2016-07-12 00:40:13 +00:00
ent - > ereftype = ER_ENTITY ;
2005-07-03 15:16:20 +00:00
2010-08-16 02:03:02 +00:00
# ifndef SERVERONLY
2010-08-14 03:17:33 +00:00
/*force coop 1 if splitscreen and not deathmatch*/
{
if ( cl_splitscreen . value & & ! deathmatch . value & & ! coop . value )
Cvar_Set ( & coop , " 1 " ) ;
}
2010-08-16 02:03:02 +00:00
# endif
2012-11-27 03:23:19 +00:00
if ( sv_playerslots . ival > 0 )
2013-10-29 17:38:22 +00:00
i = sv_playerslots . ival ;
else
{
2014-03-30 08:55:06 +00:00
/*only make one slot for single-player (ktx sucks)*/
if ( ! isDedicated & & ! deathmatch . value & & ! coop . value & & svs . gametype ! = GT_Q1QVM )
2013-10-29 17:38:22 +00:00
i = 1 ;
else
2014-03-30 08:55:06 +00:00
{
i = maxclients . ival + maxspectators . ival ;
if ( i < QWMAX_CLIENTS )
i = QWMAX_CLIENTS ;
}
2013-10-29 17:38:22 +00:00
}
2020-04-19 01:23:32 +00:00
if ( playerslots )
i = playerslots ; //saved game? force it.
2018-03-25 09:36:14 +00:00
if ( i > MAX_CLIENTS )
i = MAX_CLIENTS ;
2013-10-29 17:38:22 +00:00
SV_UpdateMaxPlayers ( i ) ;
2010-08-14 03:17:33 +00:00
2004-08-23 00:15:46 +00:00
// leave slots at start for clients only
2010-08-14 03:17:33 +00:00
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
2004-08-23 00:15:46 +00:00
{
svs . clients [ i ] . viewent = 0 ;
2015-09-14 10:36:42 +00:00
ent = ED_Alloc ( svprogfuncs , false , 0 ) ; //EDICT_NUM(i+1);
2004-08-23 00:15:46 +00:00
svs . clients [ i ] . edict = ent ;
2016-07-12 00:40:13 +00:00
ent - > ereftype = ER_ENTITY ;
2004-08-23 00:15:46 +00:00
//ZOID - make sure we update frags right
svs . clients [ i ] . old_frags = 0 ;
if ( ! svs . clients [ i ] . state & & svs . clients [ i ] . name [ 0 ] ) //this is a bot.
svs . clients [ i ] . name [ 0 ] = ' \0 ' ; //make it go away
2005-02-28 07:16:19 +00:00
2007-09-03 22:37:13 +00:00
# ifdef VM_Q1
if ( svs . gametype = = GT_Q1QVM )
{ //we'll fix it up later anyway
svs . clients [ i ] . name = svs . clients [ i ] . namebuf ;
svs . clients [ i ] . team = svs . clients [ i ] . teambuf ;
}
else
# endif
{
2013-11-21 23:02:28 +00:00
svs . clients [ i ] . name = PR_AddString ( svprogfuncs , svs . clients [ i ] . namebuf , sizeof ( svs . clients [ i ] . namebuf ) , false ) ;
svs . clients [ i ] . team = PR_AddString ( svprogfuncs , svs . clients [ i ] . teambuf , sizeof ( svs . clients [ i ] . teambuf ) , false ) ;
2007-09-03 22:37:13 +00:00
}
2004-08-23 00:15:46 +00:00
}
2005-03-07 08:58:26 +00:00
break ;
2007-08-07 19:16:32 +00:00
# ifdef Q2SERVER
2013-12-29 22:48:28 +00:00
case GT_QUAKE2 :
2013-10-29 17:38:22 +00:00
SV_UpdateMaxPlayers ( svq2_maxclients ) ;
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
2004-08-23 00:15:46 +00:00
{
q2ent = Q2EDICT_NUM ( i + 1 ) ;
q2ent - > s . number = i + 1 ;
svs . clients [ i ] . q2edict = q2ent ;
}
2007-08-07 19:16:32 +00:00
break ;
2013-12-29 22:48:28 +00:00
# endif
2007-08-07 19:16:32 +00:00
# ifdef Q3SERVER
2013-12-29 22:48:28 +00:00
case GT_QUAKE3 :
2022-03-08 05:31:34 +00:00
Cvar_LockFromServer ( & maxclients , maxclients . string ) ;
2020-04-19 01:23:32 +00:00
SV_UpdateMaxPlayers ( playerslots ? playerslots : max ( 8 , maxclients . ival ) ) ;
2009-03-03 01:52:30 +00:00
break ;
2013-12-29 22:48:28 +00:00
# endif
2009-03-03 01:52:30 +00:00
# ifdef HLSERVER
2013-12-29 22:48:28 +00:00
case GT_HALFLIFE :
2009-03-03 01:52:30 +00:00
SVHL_SetupGame ( ) ;
2013-12-29 22:48:28 +00:00
SV_UpdateMaxPlayers ( 32 ) ;
2007-08-07 19:16:32 +00:00
break ;
2013-12-29 22:48:28 +00:00
# endif
2005-03-07 08:58:26 +00:00
}
2013-10-29 17:38:22 +00:00
//fixme: is this right?
2004-08-23 00:15:46 +00:00
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
2005-05-17 02:36:54 +00:00
{
2018-07-05 16:21:44 +00:00
Q_strncpyz ( svs . clients [ i ] . name , InfoBuf_ValueForKey ( & svs . clients [ i ] . userinfo , " name " ) , sizeof ( svs . clients [ i ] . namebuf ) ) ;
Q_strncpyz ( svs . clients [ i ] . team , InfoBuf_ValueForKey ( & svs . clients [ i ] . userinfo , " team " ) , sizeof ( svs . clients [ i ] . teambuf ) ) ;
2005-05-17 02:36:54 +00:00
}
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
//SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2004-08-23 00:15:46 +00:00
# endif
2018-09-23 19:35:24 +00:00
NET_InitServer ( ) ;
2004-08-23 00:15:46 +00:00
//
// spawn the rest of the entities on the map
2005-07-03 15:16:20 +00:00
//
2004-08-23 00:15:46 +00:00
// precache and static commands can be issued during
// map initialization
sv . state = ss_loading ;
if ( svprogfuncs )
{
2007-09-02 19:55:17 +00:00
//world entity is hackily spawned
2004-08-23 00:15:46 +00:00
extern cvar_t coop , pr_imitatemvdsv ;
2018-04-06 17:21:15 +00:00
ent = EDICT_NUM_PB ( svprogfuncs , 0 ) ;
2016-07-12 00:40:13 +00:00
ent - > ereftype = ER_ENTITY ;
2007-09-03 22:37:13 +00:00
# ifdef VM_Q1
if ( svs . gametype ! = GT_Q1QVM ) //we cannot do this with qvm
# endif
2014-08-27 08:41:31 +00:00
svprogfuncs - > SetStringField ( svprogfuncs , ent , & ent - > v - > model , sv . strings . model_precache [ 1 ] , true ) ;
2005-03-28 00:11:59 +00:00
ent - > v - > modelindex = 1 ; // world model
ent - > v - > solid = SOLID_BSP ;
ent - > v - > movetype = MOVETYPE_PUSH ;
2015-02-02 08:01:53 +00:00
VectorCopy ( sv . world . worldmodel - > mins , ent - > v - > mins ) ;
VectorCopy ( sv . world . worldmodel - > maxs , ent - > v - > maxs ) ;
2017-08-14 16:38:44 +00:00
VectorCopy ( sv . world . worldmodel - > mins , ent - > v - > absmin ) ;
VectorCopy ( sv . world . worldmodel - > maxs , ent - > v - > absmax ) ;
2004-08-23 00:15:46 +00:00
if ( progstype = = PROG_QW & & pr_imitatemvdsv . value > 0 )
{
2007-09-03 22:37:13 +00:00
# ifdef VM_Q1
if ( svs . gametype ! = GT_Q1QVM ) //we cannot do this with qvm
# endif
{
2014-03-30 08:55:06 +00:00
svprogfuncs - > SetStringField ( svprogfuncs , ent , & ent - > v - > targetname , " mvdsv " , true ) ;
svprogfuncs - > SetStringField ( svprogfuncs , ent , & ent - > v - > netname , version_string ( ) , false ) ;
2007-09-03 22:37:13 +00:00
}
2005-03-28 00:11:59 +00:00
ent - > v - > impulse = 0 ; //QWE_VERNUM;
ent - > v - > items = 103 ;
2004-08-23 00:15:46 +00:00
}
2007-09-03 22:37:13 +00:00
# ifdef VM_Q1
if ( svs . gametype ! = GT_Q1QVM ) //we cannot do this with qvm
# 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
svprogfuncs - > SetStringField ( svprogfuncs , NULL , & pr_global_struct - > mapname , svs . name , true ) ;
2007-09-13 15:32:23 +00:00
2004-08-23 00:15:46 +00:00
// serverflags are for cross level information (sigils)
pr_global_struct - > serverflags = svs . serverflags ;
2024-06-05 02:43:00 +00:00
pr_global_struct - > time = 1.0 ; //match nq behaviour
2004-08-23 00:15:46 +00:00
2014-10-05 20:04:11 +00:00
# ifdef HEXEN2
2004-08-23 00:15:46 +00:00
if ( progstype = = PROG_H2 )
{
2016-07-12 00:40:13 +00:00
eval_t * eval ;
2006-03-23 19:22:12 +00:00
cvar_t * cv ;
2004-08-23 00:15:46 +00:00
if ( coop . value )
{
2011-05-20 04:10:46 +00:00
eval = PR_FindGlobal ( svprogfuncs , " coop " , 0 , NULL ) ;
2004-08-23 00:15:46 +00:00
if ( eval ) eval - > _float = coop . value ;
}
else
{
2011-05-20 04:10:46 +00:00
eval = PR_FindGlobal ( svprogfuncs , " deathmatch " , 0 , NULL ) ;
2004-08-23 00:15:46 +00:00
if ( eval ) eval - > _float = deathmatch . value ;
}
2021-04-14 05:21:04 +00:00
cv = Cvar_Get ( " randomclass " , " 0 " , CVAR_MAPLATCH , " Hexen2 " ) ;
2011-05-20 04:10:46 +00:00
eval = PR_FindGlobal ( svprogfuncs , " randomclass " , 0 , NULL ) ;
2006-03-23 19:22:12 +00:00
if ( eval & & cv ) eval - > _float = cv - > value ;
2004-08-23 00:15:46 +00:00
2006-03-23 19:22:12 +00:00
cv = Cvar_Get ( " cl_playerclass " , " 1 " , CVAR_USERINFO | CVAR_ARCHIVE , " Hexen2 " ) ;
2011-05-20 04:10:46 +00:00
eval = PR_FindGlobal ( svprogfuncs , " cl_playerclass " , 0 , NULL ) ;
2006-03-23 19:22:12 +00:00
if ( eval & & cv ) eval - > _float = cv - > value ;
2004-08-23 00:15:46 +00:00
}
else
2014-10-05 20:04:11 +00:00
# endif
2004-08-23 00:15:46 +00:00
{
2011-10-27 16:16:29 +00:00
if ( pr_global_ptrs - > coop & & coop . value )
2004-08-23 00:15:46 +00:00
pr_global_struct - > coop = coop . value ;
2011-10-27 16:16:29 +00:00
else if ( pr_global_ptrs - > deathmatch )
2004-08-23 00:15:46 +00:00
pr_global_struct - > deathmatch = deathmatch . value ;
}
2005-05-17 02:36:54 +00:00
2011-07-10 21:32:51 +00:00
if ( svs . gametype ! = GT_Q1QVM ) //we cannot do this with qvm
2004-08-23 00:15:46 +00:00
{
2011-07-10 21:32:51 +00:00
for ( i = 0 ; i < svs . numprogs ; i + + ) //do this AFTER precaches have been played with...
2004-08-23 00:15:46 +00:00
{
2011-07-10 21:32:51 +00:00
f = PR_FindFunction ( svprogfuncs , " initents " , svs . progsnum [ i ] ) ;
if ( f )
{
PR_ExecuteProgram ( svprogfuncs , f ) ;
}
2004-08-23 00:15:46 +00:00
}
}
2011-09-03 03:49:43 +00:00
if ( progstype = = PROG_QW )
// run the frame start qc function to let progs check cvars
SV_ProgStartFrame ( ) ; //prydon gate seems to fail because of this allowance
2004-08-23 00:15:46 +00:00
}
// load and spawn all other entities
2012-05-09 15:30:53 +00:00
SCR_SetLoadingFile ( " entities " ) ;
2014-08-27 08:41:31 +00:00
if ( ! deathmatch . value & & ! * skill . string ) //skill was left blank so it doesn't polute serverinfo on deathmatch servers. in single player, we ensure that it gets a proper value.
Cvar_Set ( & skill , " 1 " ) ;
2004-08-23 00:15:46 +00:00
//do this and get the precaches/start up the game
2014-10-05 20:04:11 +00:00
if ( sv . world . worldmodel - > entitiescrc )
2004-08-23 00:15:46 +00:00
{
char crc [ 12 ] ;
2014-10-05 20:04:11 +00:00
sprintf ( crc , " %i " , sv . world . worldmodel - > entitiescrc ) ;
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForStarKey ( & svs . info , " *entfile " , crc ) ;
2004-08-23 00:15:46 +00:00
}
else
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForStarKey ( & svs . info , " *entfile " , " " ) ;
2013-12-02 14:30:30 +00:00
2016-11-25 08:14:54 +00:00
file = Mod_GetEntitiesString ( sv . world . worldmodel ) ;
2014-02-11 17:51:29 +00:00
if ( ! file )
2014-10-05 20:04:11 +00:00
file = " " ;
2014-02-11 17:51:29 +00:00
2013-12-02 14:30:30 +00:00
switch ( svs . gametype )
{
2013-12-29 22:48:28 +00:00
default :
2016-10-22 07:06:51 +00:00
PR_SpawnInitialEntities ( file ) ;
2013-12-02 14:30:30 +00:00
break ;
2007-08-07 19:16:32 +00:00
# ifdef Q2SERVER
2013-12-29 22:48:28 +00:00
case GT_QUAKE2 :
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
ge - > SpawnEntities ( svs . name , file , startspot ? startspot : " " ) ;
2013-12-02 14:30:30 +00:00
break ;
2013-12-29 22:48:28 +00:00
# endif
2013-12-02 14:30:30 +00:00
case GT_QUAKE3 :
break ;
2009-03-03 01:52:30 +00:00
# ifdef HLSERVER
2013-12-29 22:48:28 +00:00
case GT_HALFLIFE :
2014-02-11 17:51:29 +00:00
SVHL_SpawnEntities ( file ) ;
break ;
2009-03-03 01:52:30 +00:00
# endif
2004-08-23 00:15:46 +00:00
}
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
//SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2004-08-23 00:15:46 +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
Q_strncpyz ( sv . mapname , svs . name , sizeof ( sv . mapname ) ) ;
2004-08-23 00:15:46 +00:00
if ( svprogfuncs )
{
eval_t * val ;
2018-04-06 17:21:15 +00:00
ent = EDICT_NUM_PB ( svprogfuncs , 0 ) ;
2005-03-28 00:11:59 +00:00
ent - > v - > angles [ 0 ] = ent - > v - > angles [ 1 ] = ent - > v - > angles [ 2 ] = 0 ;
2016-07-12 00:40:13 +00:00
if ( ( val = svprogfuncs - > GetEdictFieldValue ( svprogfuncs , ent , " message " , ev_string , NULL ) ) )
snprintf ( sv . mapname , sizeof ( sv . mapname ) , " %s " , PR_GetString ( svprogfuncs , val - > string ) ) ;
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
2016-07-12 00:40:13 +00:00
else if ( progstype = = PROG_H2 & & ( val = svprogfuncs - > GetEdictFieldValue ( svprogfuncs , ent , " message " , ev_float , NULL ) ) )
2019-02-23 09:38:04 +00:00
{ //hexen2 uses a float string index for message.
//if its 0 or negative, fall back on netname instead (for custom maps).
if ( val - > _float < = 0 )
snprintf ( sv . mapname , sizeof ( sv . mapname ) , " %s " , PR_GetString ( svprogfuncs , ent - > v - > netname ) ) ;
else
snprintf ( sv . mapname , sizeof ( sv . mapname ) , " %s " , T_GetString ( val - > _float - 1 ) ) ;
2004-08-23 00:15:46 +00:00
}
2016-07-12 00:40:13 +00:00
# endif
2007-09-02 19:55:17 +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
snprintf ( sv . mapname , sizeof ( sv . mapname ) , " %s " , svs . name ) ;
2005-08-26 22:56:51 +00:00
if ( Cvar_Get ( " sv_readonlyworld " , " 1 " , 0 , " DP compatability " ) - > value )
2014-04-02 00:58:02 +00:00
{
2005-08-26 22:56:51 +00:00
ent - > readonly = true ; //lock it down!
2004-08-23 00:15:46 +00:00
2014-04-02 00:58:02 +00:00
if ( ent - > v - > origin [ 0 ] ! = 0 | | ent - > v - > origin [ 1 ] ! = 0 | | ent - > v - > origin [ 2 ] ! = 0 | | ent - > v - > angles [ 0 ] ! = 0 | | ent - > v - > angles [ 1 ] ! = 0 | | ent - > v - > angles [ 2 ] ! = 0 )
Con_Printf ( " Warning: The world has moved. Alert your nearest reputable news agency. \n " ) ;
}
2005-05-19 02:53:03 +00:00
// look up some model indexes for specialized message compression
SV_FindModelNumbers ( ) ;
}
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
//SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2004-08-23 00:15:46 +00:00
# endif
// run two frames to allow everything to settle
2014-08-17 02:27:54 +00:00
//these frames must be at 1.0 then 1.1 (and 0.1 frametime)
//(bug: starting less than that gives time for the scrag to fall on end)
2016-07-12 00:40:13 +00:00
//hexen2: if you're looking here for the coop-invincible-riders bug, then that's a hexenc bug, not an fte one, and is also present in vanilla hexen2.
2004-08-23 00:15:46 +00:00
realtime + = 0.1 ;
2014-08-17 02:27:54 +00:00
sv . world . physicstime = 1.0 ;
sv . time = 1.1 ;
2004-08-23 00:15:46 +00:00
SV_Physics ( ) ;
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
//SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2004-08-23 00:15:46 +00:00
# endif
realtime + = 0.1 ;
2014-08-17 02:27:54 +00:00
// sv.world.physicstime = 1.1;
2004-08-23 00:15:46 +00:00
sv . time + = 0.1 ;
SV_Physics ( ) ;
2014-08-17 02:27:54 +00:00
sv . time + = 0.1 ;
2004-08-23 00:15:46 +00:00
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
//SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2004-08-23 00:15:46 +00:00
# endif
// save movement vars
SV_SetMoveVars ( ) ;
// create a baseline for more efficient communications
// SV_CreateBaseline ();
2005-05-19 02:53:03 +00:00
if ( svprogfuncs )
2015-10-11 11:34:58 +00:00
SVQ1_CreateBaseline ( ) ;
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
# ifdef Q2SERVER
SVQ2_BuildBaselines ( ) ;
# endif
2019-09-17 19:49:39 +00:00
SV_FlushSignon ( true ) ;
2004-08-23 00:15:46 +00:00
2004-09-04 17:56:53 +00:00
// all spawning is completed, any further precache statements
// or prog writes to the signon message are errors
if ( usecinematic )
sv . state = ss_cinematic ;
else
sv . state = ss_active ;
2004-08-23 00:15:46 +00:00
SV_GibFilterInit ( ) ;
SV_FilterImpulseInit ( ) ;
2018-07-05 16:21:44 +00:00
InfoBuf_SetValueForKey ( & svs . info , " map " , svs . name ) ;
2012-01-17 07:57:46 +00:00
if ( sv . allocated_client_slots ! = 1 )
2013-11-29 14:36:47 +00:00
Con_TPrintf ( " Server spawned. \n " ) ; //misc filenotfounds can be misleading.
2004-08-23 00:15:46 +00:00
if ( ! startspot )
{
2018-08-04 07:05:20 +00:00
# ifdef SAVEDGAMES
2004-08-23 00:15:46 +00:00
SV_FlushLevelCache ( ) ; //to make sure it's caught
2018-08-04 07:05:20 +00:00
# endif
2021-09-01 07:30:48 +00:00
/*for (i=0 ; i<sv.allocated_client_slots ; i++)
2004-08-23 00:15:46 +00:00
{
if ( svs . clients [ i ] . spawninfo )
Z_Free ( svs . clients [ i ] . spawninfo ) ;
svs . clients [ i ] . spawninfo = NULL ;
2021-09-01 07:30:48 +00:00
} */
2004-08-23 00:15:46 +00:00
}
if ( svprogfuncs & & startspot )
{
eval_t * eval ;
2011-05-20 04:10:46 +00:00
eval = PR_FindGlobal ( svprogfuncs , " startspot " , 0 , NULL ) ;
2018-04-06 17:21:15 +00:00
if ( eval & & svs . gametype ! = GT_Q1QVM ) //we cannot do this with qvm
svprogfuncs - > SetStringField ( svprogfuncs , NULL , & eval - > string , startspot , false ) ;
2004-08-23 00:15:46 +00:00
}
if ( Cmd_AliasExist ( " f_svnewmap " , RESTRICT_LOCAL ) )
Cbuf_AddText ( " f_svnewmap \n " , RESTRICT_LOCAL ) ;
# ifndef SERVERONLY
current_loading_size + = 10 ;
2006-09-17 00:59:22 +00:00
//SCR_BeginLoadingPlaque();
SCR_ImageName ( server ) ;
2004-08-23 00:15:46 +00:00
# endif
2005-08-26 22:56:51 +00:00
2013-12-29 22:48:28 +00:00
/*world is now spawned. switch to big coords if there are entities outside the bounds of the map*/
if ( ! * sv_bigcoords . string & & svprogfuncs )
{
float extent = 0 , ne ;
//fixme: go off bsp extents instead?
for ( i = 1 ; i < sv . world . num_edicts ; i + + )
{
2018-04-06 17:21:15 +00:00
ent = EDICT_NUM_PB ( svprogfuncs , i ) ;
2013-12-29 22:48:28 +00:00
for ( j = 0 ; j < 3 ; j + + )
{
ne = fabs ( ent - > v - > origin [ j ] ) ;
if ( extent < ne )
extent = ne ;
}
}
2014-10-05 20:04:11 +00:00
if ( extent > ( 1u < < 15 ) / 8
# ifdef TERRAIN
| | sv . world . worldmodel - > terrain
# endif
)
2013-12-29 22:48:28 +00:00
{
2019-09-17 19:49:39 +00:00
if ( sv . used_signon_space | | sv . signon . cursize )
2013-12-29 22:48:28 +00:00
Con_Printf ( " Cannot auto-enable extended coords as the init buffer was used \n " ) ;
else
{
Con_Printf ( " Switching to extended coord sizes \n " ) ;
SV_SetupNetworkBuffers ( true ) ;
}
}
}
2010-08-16 02:03:02 +00:00
/*DP_BOTCLIENT bots should move over to the new map too*/
2007-09-02 19:55:17 +00:00
if ( svs . gametype = = GT_PROGS | | svs . gametype = = GT_Q1QVM )
2005-08-26 22:56:51 +00:00
{
2005-09-14 04:39:36 +00:00
for ( i = 0 ; i < sv . allocated_client_slots ; i + + )
2005-08-26 22:56:51 +00:00
{
host_client = & svs . clients [ i ] ;
if ( host_client - > state = = cs_connected & & host_client - > protocol = = SCP_BAD )
{
2022-05-28 17:59:17 +00:00
if ( svs . gametype = = GT_Q1QVM )
{ //ktx expects its bots to drop for each map change.
SV_DropClient ( host_client ) ;
continue ;
}
2005-08-26 22:56:51 +00:00
sv_player = host_client - > edict ;
------------------------------------------------------------------------
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
SV_ExtractFromUserinfo ( host_client , true ) ;
2017-05-28 15:42:32 +00:00
SV_SpawnParmsToQC ( host_client ) ;
2005-10-07 16:27:20 +00:00
SV_SetUpClientEdict ( host_client , sv_player ) ;
2019-04-16 22:40:05 +00:00
# ifdef HAVE_LEGACY
2017-08-29 02:29:06 +00:00
sv_player - > xv - > clientcolors = host_client - > playercolor ;
2016-07-12 00:40:13 +00:00
# endif
2005-09-14 04:39:36 +00:00
2005-08-26 22:56:51 +00:00
// call the spawn function
2014-03-30 08:55:06 +00:00
sv . skipbprintclient = host_client ;
2009-11-04 21:16:50 +00:00
pr_global_struct - > time = sv . world . physicstime ;
2005-08-26 22:56:51 +00:00
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , sv_player ) ;
2018-03-04 14:41:16 +00:00
if ( pr_global_ptrs - > ClientConnect )
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > ClientConnect ) ;
2014-03-30 08:55:06 +00:00
sv . skipbprintclient = NULL ;
2005-08-26 22:56:51 +00:00
// actually spawn the player
2009-11-04 21:16:50 +00:00
pr_global_struct - > time = sv . world . physicstime ;
2005-08-26 22:56:51 +00:00
pr_global_struct - > self = EDICT_TO_PROG ( svprogfuncs , sv_player ) ;
2018-03-04 14:41:16 +00:00
if ( pr_global_ptrs - > PutClientInServer )
PR_ExecuteProgram ( svprogfuncs , pr_global_struct - > PutClientInServer ) ;
2012-01-17 07:57:46 +00:00
sv . spawned_client_slots + + ;
2005-08-26 22:56:51 +00:00
// send notification to all clients
host_client - > sendinfo = true ;
host_client - > state = cs_spawned ;
2017-08-14 16:38:44 +00:00
host_client - > spawned = true ;
2005-08-26 22:56:51 +00:00
SV_UpdateToReliableMessages ( ) ; //so that we don't flood too much with 31 bots and one player.
}
}
}
2013-10-09 01:00:24 +00:00
# ifdef Q3SERVER
2013-08-27 13:18:09 +00:00
if ( svs . gametype = = GT_QUAKE3 )
{
2022-03-08 05:31:34 +00:00
q3 - > sv . NewMapConnects ( ) ;
2013-08-27 13:18:09 +00:00
}
2013-10-09 01:00:24 +00:00
# endif
2006-11-03 15:53:04 +00:00
2011-12-05 15:23:40 +00:00
FS_ReferenceControl ( 0 , 0 ) ;
2018-09-01 04:18:08 +00:00
# ifdef MVD_RECORDING
2006-11-03 15:53:04 +00:00
SV_MVD_SendInitialGamestate ( NULL ) ;
2018-09-01 04:18:08 +00:00
# endif
2014-03-30 08:55:06 +00:00
SSV_UpdateAddresses ( ) ;
2014-04-12 03:31:59 +00:00
//some mods stuffcmd these, and it would be a shame if they didn't work. we still need the earlier call in case the mod does extra stuff.
SV_SetMoveVars ( ) ;
2015-01-08 13:09:20 +00:00
sv . starttime = Sys_DoubleTime ( ) - sv . time ;
2018-08-04 07:05:20 +00:00
# ifdef SAVEDGAMES
2016-01-18 05:22:07 +00:00
sv . autosave_time = sv . time + sv_autosave . value * 60 ;
2018-08-04 07:05:20 +00:00
# endif
2022-03-01 02:51:46 +00:00
2022-03-08 05:31:34 +00:00
# ifdef HAVE_CLIENT
//there's a whole load of ugly debug crap there. make sure it stays hidden.
Con_ClearNotify ( ) ;
# endif
2022-03-01 02:51:46 +00:00
# ifdef __GLIBC__
if ( isDedicated )
malloc_trim ( 0 ) ;
# endif
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