Browse Source

Apply Apr19 update

pull/2/head
mittorn 7 years ago
parent
commit
db92c918b2
  1. 2
      common/const.h
  2. 33
      engine/cdll_int.h
  3. 121
      engine/client/cl_game.c
  4. 23
      engine/client/cl_main.c
  5. 3
      engine/client/gl_rmain.c
  6. 12
      engine/client/gl_vidnt.c
  7. 6
      engine/common/cfgscript.c
  8. 1
      engine/common/common.h
  9. 5
      engine/common/con_utils.c
  10. 28
      engine/common/cvar.c
  11. 3
      engine/common/host.c
  12. 8
      engine/common/mod_bmodel.c
  13. 37
      engine/server/sv_client.c
  14. 29
      engine/server/sv_cmds.c

2
common/const.h

@ -732,6 +732,8 @@ typedef int string_t;
typedef unsigned char byte; typedef unsigned char byte;
typedef unsigned short word; typedef unsigned short word;
#define Q_isspace( ch ) (ch < 32 || ch > 255)
#undef true #undef true
#undef false #undef false

33
engine/cdll_int.h

@ -248,6 +248,39 @@ typedef struct cl_enginefuncs_s
void (*pfnGetMousePos)( struct tagPOINT *ppt ); void (*pfnGetMousePos)( struct tagPOINT *ppt );
void (*pfnSetMousePos)( int x, int y ); void (*pfnSetMousePos)( int x, int y );
void (*pfnSetMouseEnable)( qboolean fEnable ); void (*pfnSetMouseEnable)( qboolean fEnable );
void (*pfnUnused1)( void );
void (*pfnUnused2)( void );
void (*pfnUnused3)( void );
void (*pfnUnused4)( void );
float (*pfnGetClientOldTime)( void );
float (*pfnGetGravity)( void );
struct model_s*(*pfnGetModelByIndex)( int index );
void (*pfnUnused5)( void );
void (*pfnUnused6)( void );
void (*pfnUnused7)( void );
void (*pfnUnused8)( void );
void (*pfnUnused9)( void );
void (*pfnUnused10)( void );
void (*pfnUnused11)( void );
void (*pfnUnused12)( void );
const char*(*LocalPlayerInfo_ValueForKey)( const char* key );
void (*pfnUnused13)( void );
void (*pfnUnused14)( void );
void (*pfnUnused15)( void );
void (*pfnUnused16)( void );
void (*Cvar_Set)( char *name, char *value );
void (*pfnUnused17)( void );
void (*pfnUnused18)( void );
void (*pfnUnused19)( void );
double (*pfnSys_FloatTime)( void );
void (*pfnUnused20)( void );
void (*pfnUnused21)( void );
void (*pfnUnused22)( void );
void (*pfnUnused23)( void );
void (*pfnFillRGBABlend)( int x, int y, int width, int height, int r, int g, int b, int a );
int (*pfnGetAppID)( void );
void (*pfnUnused24)( void );
void (*pfnUnused25)( void );
} cl_enginefunc_t; } cl_enginefunc_t;
#define CLDLL_INTERFACE_VERSION 7 #define CLDLL_INTERFACE_VERSION 7

121
engine/client/cl_game.c

@ -2780,6 +2780,83 @@ char *pfnParseFile( char *data, char *token )
return out; return out;
} }
/*
=============
pfnGetServerTime
=============
*/
float pfnGetClientOldTime( void )
{
return cl.oldtime;
}
/*
=============
pfnGetGravity
=============
*/
float pfnGetGravity( void )
{
return clgame.movevars.gravity;
}
/*
=============
LocalPlayerInfo_ValueForKey
=============
*/
const char *LocalPlayerInfo_ValueForKey( const char* key )
{
return Info_ValueForKey( cls.userinfo, key );
}
/*
=============
CL_FillRGBABlend
=============
*/
void CL_FillRGBABlend( int x, int y, int w, int h, int r, int g, int b, int a )
{
r = bound( 0, r, 255 );
g = bound( 0, g, 255 );
b = bound( 0, b, 255 );
a = bound( 0, a, 255 );
SPR_AdjustSize( (float *)&x, (float *)&y, (float *)&w, (float *)&h );
pglDisable( GL_TEXTURE_2D );
pglEnable( GL_BLEND );
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
pglColor4f( r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f );
pglBegin( GL_QUADS );
pglVertex2f( x, y );
pglVertex2f( x + w, y );
pglVertex2f( x + w, y + h );
pglVertex2f( x, y + h );
pglEnd ();
pglColor3f( 1.0f, 1.0f, 1.0f );
pglEnable( GL_TEXTURE_2D );
pglDisable( GL_BLEND );
}
/*
=============
pfnGetAppID
=============
*/
int pfnGetAppID( void )
{
return 70;
}
/* /*
================= =================
TriApi implementation TriApi implementation
@ -3493,6 +3570,17 @@ float Voice_GetControlFloat( VoiceTweakControl iControl )
return 1.0f; return 1.0f;
} }
/*
=============
pfnEngineStub
extended iface stubs
=============
*/
static void pfnEngineStub( void )
{
}
// shared between client and server // shared between client and server
triangleapi_t gTriApi = triangleapi_t gTriApi =
{ {
@ -3764,6 +3852,39 @@ static cl_enginefunc_t gEngfuncs =
pfnGetMousePos, pfnGetMousePos,
pfnSetMousePos, pfnSetMousePos,
pfnSetMouseEnable, pfnSetMouseEnable,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
pfnGetClientOldTime,
pfnGetGravity,
CL_ModelHandle,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
LocalPlayerInfo_ValueForKey,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
Cvar_Set,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
Sys_DoubleTime,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
pfnEngineStub,
CL_FillRGBABlend,
pfnGetAppID,
pfnEngineStub,
pfnEngineStub,
}; };
void CL_UnloadProgs( void ) void CL_UnloadProgs( void )

23
engine/client/cl_main.c

@ -26,6 +26,7 @@ GNU General Public License for more details.
#define MAX_CMD_BUFFER 8000 #define MAX_CMD_BUFFER 8000
#define CONNECTION_PROBLEM_TIME 15.0 // 15 seconds #define CONNECTION_PROBLEM_TIME 15.0 // 15 seconds
#define CL_CONNECTION_RETRIES 10 #define CL_CONNECTION_RETRIES 10
#define CL_TEST_RETRIES_NORESPONCE 2
#define CL_TEST_RETRIES 5 #define CL_TEST_RETRIES 5
CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" ); CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" );
@ -194,7 +195,7 @@ int CL_GetFragmentSize( void *unused )
if( Netchan_IsLocal( &cls.netchan )) if( Netchan_IsLocal( &cls.netchan ))
return FRAGMENT_LOCAL_SIZE; return FRAGMENT_LOCAL_SIZE;
return FRAGMENT_MAX_SIZE; return bound( FRAGMENT_MIN_SIZE, cl_dlmax->value, FRAGMENT_MAX_SIZE );
} }
/* /*
@ -1089,11 +1090,12 @@ void CL_CheckForResend( void )
if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER ); if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER );
if( cls.connect_retry == CL_TEST_RETRIES ) if( cls.connect_retry == CL_TEST_RETRIES_NORESPONCE )
{ {
// too many fails use default connection method // too many fails use default connection method
Msg( "hi-speed coonection is failed, use default method\n" );
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" ); Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
Cvar_SetValue( "cl_dlmax", FRAGMENT_MAX_SIZE ); Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
cls.connect_time = host.realtime; cls.connect_time = host.realtime;
cls.connect_retry++; cls.connect_retry++;
return; return;
@ -1103,7 +1105,7 @@ void CL_CheckForResend( void )
cls.connect_time = host.realtime; // for retransmit requests cls.connect_time = host.realtime; // for retransmit requests
cls.connect_retry++; cls.connect_retry++;
Con_Printf( "Connecting to %s...\n", cls.servername ); Con_Printf( "Connecting to %s... [retry #%i]\n", cls.servername, cls.connect_retry );
if( cl_test_bandwidth.value ) if( cl_test_bandwidth.value )
Netchan_OutOfBandPrint( NS_CLIENT, adr, "bandwidth %i %i\n", PROTOCOL_VERSION, cls.max_fragment_size ); Netchan_OutOfBandPrint( NS_CLIENT, adr, "bandwidth %i %i\n", PROTOCOL_VERSION, cls.max_fragment_size );
@ -1182,12 +1184,16 @@ void CL_Connect_f( void )
Q_strncpy( server, Cmd_Argv( 1 ), sizeof( server )); Q_strncpy( server, Cmd_Argv( 1 ), sizeof( server ));
// if running a local server, kill it and reissue // if running a local server, kill it and reissue
// if( SV_Active( )) Host_ShutdownServer(); if( SV_Active( )) Host_ShutdownServer();
NET_Config( true ); // allow remote NET_Config( true ); // allow remote
Con_Printf( "server %s\n", server ); Con_Printf( "server %s\n", server );
CL_Disconnect(); CL_Disconnect();
// TESTTEST: a see console during connection
UI_SetActiveMenu( false );
Key_SetKeyDest( key_console );
cls.state = ca_connecting; cls.state = ca_connecting;
Q_strncpy( cls.servername, server, sizeof( cls.servername )); Q_strncpy( cls.servername, server, sizeof( cls.servername ));
cls.connect_time = MAX_HEARTBEAT; // CL_CheckForResend() will fire immediately cls.connect_time = MAX_HEARTBEAT; // CL_CheckForResend() will fire immediately
@ -1794,8 +1800,9 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
if( cls.connect_retry >= CL_TEST_RETRIES ) if( cls.connect_retry >= CL_TEST_RETRIES )
{ {
// too many fails use default connection method // too many fails use default connection method
Msg( "hi-speed coonection is failed, use default method\n" );
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" ); Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
Cvar_SetValue( "cl_dlmax", FRAGMENT_MAX_SIZE ); Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
cls.connect_time = host.realtime; cls.connect_time = host.realtime;
return; return;
} }
@ -1825,8 +1832,9 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
if( cls.connect_retry >= CL_TEST_RETRIES ) if( cls.connect_retry >= CL_TEST_RETRIES )
{ {
// too many fails use default connection method // too many fails use default connection method
Msg( "hi-speed coonection is failed, use default method\n" );
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" ); Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
Cvar_SetValue( "cl_dlmax", FRAGMENT_MAX_SIZE ); Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
cls.connect_time = host.realtime; cls.connect_time = host.realtime;
return; return;
} }
@ -2595,6 +2603,7 @@ void CL_InitLocal( void )
Cmd_AddCommand ("give", NULL, "give specified item or weapon" ); Cmd_AddCommand ("give", NULL, "give specified item or weapon" );
Cmd_AddCommand ("drop", NULL, "drop current/specified item or weapon" ); Cmd_AddCommand ("drop", NULL, "drop current/specified item or weapon" );
Cmd_AddCommand ("gametitle", NULL, "show game logo" ); Cmd_AddCommand ("gametitle", NULL, "show game logo" );
Cmd_AddCommand( "kill", NULL, "die instantly" );
Cmd_AddCommand ("god", NULL, "enable godmode" ); Cmd_AddCommand ("god", NULL, "enable godmode" );
Cmd_AddCommand ("fov", NULL, "set client field of view" ); Cmd_AddCommand ("fov", NULL, "set client field of view" );
Cmd_AddCommand ("log", NULL, "logging server events" ); Cmd_AddCommand ("log", NULL, "logging server events" );

3
engine/client/gl_rmain.c

@ -1084,6 +1084,9 @@ void R_RenderFrame( const ref_viewpass_t *rvp )
if( gl_finish->value && RI.drawWorld ) if( gl_finish->value && RI.drawWorld )
pglFinish(); pglFinish();
if( glConfig.max_multisamples > 1 )
pglEnable( GL_MULTISAMPLE_ARB );
// completely override rendering // completely override rendering
if( clgame.drawFuncs.GL_RenderFrame != NULL ) if( clgame.drawFuncs.GL_RenderFrame != NULL )
{ {

12
engine/client/gl_vidnt.c

@ -1480,9 +1480,6 @@ static void GL_SetDefaults( void )
pglDepthFunc( GL_LEQUAL ); pglDepthFunc( GL_LEQUAL );
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
if( glConfig.max_multisamples > 1 )
pglEnable( GL_MULTISAMPLE_ARB );
if( glState.stencilEnabled ) if( glState.stencilEnabled )
{ {
pglDisable( GL_STENCIL_TEST ); pglDisable( GL_STENCIL_TEST );
@ -1621,6 +1618,12 @@ void GL_InitCommands( void )
Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" ); Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" );
// give initial OpenGL configuration
host.apply_opengl_config = true;
Cbuf_AddText( "exec opengl.cfg\n" );
Cbuf_Execute();
host.apply_opengl_config = false;
// apply actual video mode to window // apply actual video mode to window
Cbuf_AddText( "exec video.cfg\n" ); Cbuf_AddText( "exec video.cfg\n" );
Cbuf_Execute(); Cbuf_Execute();
@ -1826,9 +1829,6 @@ qboolean R_Init( void )
if( glw_state.initialized ) if( glw_state.initialized )
return true; return true;
// give initial OpenGL configuration
Cbuf_AddText( "exec opengl.cfg\n" );
GL_InitCommands(); GL_InitCommands();
GL_InitRandomTable(); GL_InitRandomTable();
GL_SetDefaultState(); GL_SetDefaultState();

6
engine/common/cfgscript.c

@ -231,8 +231,6 @@ int CSCR_WriteGameCVars( file_t *cfg, const char *scriptfilename )
goto finish; goto finish;
} }
FS_Printf( cfg, "// declared in %s:\n", scriptfilename );
while( !CSCR_ExpectString( &state, "}", false, false )) while( !CSCR_ExpectString( &state, "}", false, false ))
{ {
scrvardef_t var = { 0 }; scrvardef_t var = { 0 };
@ -245,8 +243,8 @@ int CSCR_WriteGameCVars( file_t *cfg, const char *scriptfilename )
{ {
// cvars will be placed in game.cfg and restored on map start // cvars will be placed in game.cfg and restored on map start
if( var.flags & FCVAR_USERINFO ) if( var.flags & FCVAR_USERINFO )
FS_Printf( cfg, "// %s ( %s )\nsetu %s \"%s\"\n", var.desc, var.value, var.name, cvar->string ); FS_Printf( cfg, "%s \"%s\"\n", var.name, cvar->string );
else FS_Printf( cfg, "// %s ( %s )\nset %s \"%s\"\n", var.desc, var.value, var.name, cvar->string ); else FS_Printf( cfg, "%s \"%s\"\n", var.name, cvar->string );
} }
count++; count++;
} }

1
engine/common/common.h

@ -412,6 +412,7 @@ typedef struct host_parm_s
qboolean force_draw_version; // used when fraps is loaded qboolean force_draw_version; // used when fraps is loaded
qboolean write_to_clipboard; // put image to clipboard instead of disk qboolean write_to_clipboard; // put image to clipboard instead of disk
qboolean apply_game_config; // when true apply only to game cvars and ignore all other commands qboolean apply_game_config; // when true apply only to game cvars and ignore all other commands
qboolean apply_opengl_config;// when true apply only to opengl cvars and ignore all other commands
qboolean config_executed; // a bit who indicated was config.cfg already executed e.g. from valve.rc qboolean config_executed; // a bit who indicated was config.cfg already executed e.g. from valve.rc
int sv_cvars_restored; // count of restored server cvars int sv_cvars_restored; // count of restored server cvars
qboolean crashed; // set to true if crashed qboolean crashed; // set to true if crashed

5
engine/common/con_utils.c

@ -875,8 +875,9 @@ with the archive flag set to true.
*/ */
static void Cmd_WriteOpenGLCvar( const char *name, const char *string, const char *desc, void *f ) static void Cmd_WriteOpenGLCvar( const char *name, const char *string, const char *desc, void *f )
{ {
if( !desc || !*desc ) return; // ignore cvars without description (fantom variables) if( !COM_CheckString( desc ))
FS_Printf( f, "setgl %s \"%s\"\n", name, string ); return; // ignore cvars without description (fantom variables)
FS_Printf( f, "%s \"%s\"\n", name, string );
} }
static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc, void *f ) static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc, void *f )

28
engine/common/cvar.c

@ -681,6 +681,13 @@ qboolean Cvar_Command( void )
{ {
convar_t *v; convar_t *v;
// special case for setup opengl configuration
if( host.apply_opengl_config )
{
Cvar_FullSet( Cmd_Argv( 0 ), Cmd_Argv( 1 ), FCVAR_GLCONFIG );
return true;
}
// check variables // check variables
v = Cvar_FindVar( Cmd_Argv( 0 )); v = Cvar_FindVar( Cmd_Argv( 0 ));
if( !v ) return false; if( !v ) return false;
@ -756,24 +763,6 @@ void Cvar_Toggle_f( void )
Cvar_Set( Cmd_Argv( 1 ), va( "%i", v )); Cvar_Set( Cmd_Argv( 1 ), va( "%i", v ));
} }
/*
============
Cvar_SetR_f
keep for legacy configs
============
*/
void Cvar_SetR_f( void )
{
if( Cmd_Argc() != 3 )
{
Con_Printf( S_USAGE "setr <variable> <value>\n" );
return;
}
Cvar_Set( Cmd_Argv( 1 ), Cmd_Argv( 2 ));
}
/* /*
============ ============
Cvar_SetGL_f Cvar_SetGL_f
@ -882,8 +871,7 @@ void Cvar_Init( void )
cmd_scripting = Cvar_Get( "cmd_scripting", "0", FCVAR_ARCHIVE, "enable simple condition checking and variable operations" ); cmd_scripting = Cvar_Get( "cmd_scripting", "0", FCVAR_ARCHIVE, "enable simple condition checking and variable operations" );
Cvar_RegisterVariable (&host_developer); // early registering for dev Cvar_RegisterVariable (&host_developer); // early registering for dev
Cmd_AddCommand( "setr", Cvar_SetR_f, "create or change the value of a renderinfo variable" ); Cmd_AddCommand( "setgl", Cvar_SetGL_f, "create or change the value of a opengl variable" ); // OBSOLETE
Cmd_AddCommand( "setgl", Cvar_SetGL_f, "create or change the value of a opengl variable" );
Cmd_AddCommand( "toggle", Cvar_Toggle_f, "toggles a console variable's values (use for more info)" ); Cmd_AddCommand( "toggle", Cvar_Toggle_f, "toggles a console variable's values (use for more info)" );
Cmd_AddCommand( "reset", Cvar_Reset_f, "reset any type variable to initial value" ); Cmd_AddCommand( "reset", Cvar_Reset_f, "reset any type variable to initial value" );
Cmd_AddCommand( "cvarlist", Cvar_List_f, "display all console variables beginning with the specified prefix" ); Cmd_AddCommand( "cvarlist", Cvar_List_f, "display all console variables beginning with the specified prefix" );

3
engine/common/host.c

@ -848,7 +848,6 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
} }
host.change_game = false; // done host.change_game = false; // done
Cmd_RemoveCommand( "setr" ); // remove potentially backdoor for change render settings
Cmd_RemoveCommand( "setgl" ); Cmd_RemoveCommand( "setgl" );
Cbuf_ExecStuffCmds(); // execute stuffcmds (commandline) Cbuf_ExecStuffCmds(); // execute stuffcmds (commandline)
SCR_CheckStartupVids(); // must be last SCR_CheckStartupVids(); // must be last
@ -886,7 +885,7 @@ void EXPORT Host_Shutdown( void )
if( host.type == HOST_NORMAL ) if( host.type == HOST_NORMAL )
Host_WriteConfig(); Host_WriteConfig();
SV_Shutdown( "" ); SV_Shutdown( "Server shutdown\n" );
CL_Shutdown(); CL_Shutdown();
Mod_Shutdown(); Mod_Shutdown();

8
engine/common/mod_bmodel.c

@ -1352,6 +1352,7 @@ for embedded submodels
*/ */
static void Mod_SetupSubmodels( dbspmodel_t *bmod ) static void Mod_SetupSubmodels( dbspmodel_t *bmod )
{ {
qboolean colored = false;
byte *mempool; byte *mempool;
char *ents; char *ents;
model_t *mod; model_t *mod;
@ -1360,6 +1361,8 @@ static void Mod_SetupSubmodels( dbspmodel_t *bmod )
ents = loadmodel->entities; ents = loadmodel->entities;
mempool = loadmodel->mempool; mempool = loadmodel->mempool;
if( FBitSet( loadmodel->flags, MODEL_COLORED_LIGHTING ))
colored = true;
mod = loadmodel; mod = loadmodel;
loadmodel->numframes = 2; // regular and alternate animation loadmodel->numframes = 2; // regular and alternate animation
@ -1384,7 +1387,10 @@ static void Mod_SetupSubmodels( dbspmodel_t *bmod )
mod->radius = RadiusFromBounds( mod->mins, mod->maxs ); mod->radius = RadiusFromBounds( mod->mins, mod->maxs );
mod->numleafs = bm->visleafs; mod->numleafs = bm->visleafs;
// mod->flags = 0; mod->flags = 0;
// this bit will be shared between all the submodels include worldmodel
if( colored ) SetBits( mod->flags, MODEL_COLORED_LIGHTING );
if( i != 0 ) if( i != 0 )
{ {

37
engine/server/sv_client.c

@ -1164,7 +1164,7 @@ a deathmatch.
*/ */
void SV_PutClientInServer( sv_client_t *cl ) void SV_PutClientInServer( sv_client_t *cl )
{ {
static byte msg_buf[MAX_INIT_MSG]; static byte msg_buf[0x20200]; // MAX_INIT_MSG + some space
edict_t *ent = cl->edict; edict_t *ent = cl->edict;
sizebuf_t msg; sizebuf_t msg;
@ -1215,6 +1215,9 @@ void SV_PutClientInServer( sv_client_t *cl )
if( Q_atoi( Info_ValueForKey( cl->userinfo, "hltv" ))) if( Q_atoi( Info_ValueForKey( cl->userinfo, "hltv" )))
SetBits( cl->flags, FCL_HLTV_PROXY ); SetBits( cl->flags, FCL_HLTV_PROXY );
// need to realloc private data for client
SV_InitEdict( ent );
if( FBitSet( cl->flags, FCL_HLTV_PROXY )) if( FBitSet( cl->flags, FCL_HLTV_PROXY ))
SetBits( ent->v.flags, FL_PROXY ); SetBits( ent->v.flags, FL_PROXY );
else ent->v.flags = 0; else ent->v.flags = 0;
@ -1270,13 +1273,19 @@ void SV_PutClientInServer( sv_client_t *cl )
MSG_WriteByte( &msg, 1 ); MSG_WriteByte( &msg, 1 );
if( MSG_CheckOverflow( &msg )) if( MSG_CheckOverflow( &msg ))
Host_Error( "overflow\n" ); {
if( svs.maxclients == 1 )
Host_Error( "spawn player: overflowed\n" );
else SV_DropClient( cl, false );
}
else
{
// send initialization data // send initialization data
Netchan_CreateFragments( &cl->netchan, &msg ); Netchan_CreateFragments( &cl->netchan, &msg );
Netchan_FragSend( &cl->netchan ); Netchan_FragSend( &cl->netchan );
} }
} }
}
/* /*
=========== ===========
@ -1751,6 +1760,27 @@ static qboolean SV_Notarget_f( sv_client_t *cl )
return true; return true;
} }
/*
==================
SV_Kill_f
==================
*/
static qboolean SV_Kill_f( sv_client_t *cl )
{
if( !SV_IsValidEdict( cl->edict ))
return true;
if( cl->edict->v.health <= 0.0f )
{
SV_ClientPrintf( cl, "Can't suicide - already dead!\n");
return true;
}
svgame.dllFuncs.pfnClientKill( cl->edict );
return true;
}
/* /*
================== ==================
SV_SendRes_f SV_SendRes_f
@ -1903,6 +1933,7 @@ ucmd_t ucmds[] =
{ {
{ "new", SV_New_f }, { "new", SV_New_f },
{ "god", SV_Godmode_f }, { "god", SV_Godmode_f },
{ "kill", SV_Kill_f },
{ "begin", SV_Begin_f }, { "begin", SV_Begin_f },
{ "spawn", SV_Spawn_f }, { "spawn", SV_Spawn_f },
{ "pause", SV_Pause_f }, { "pause", SV_Pause_f },

29
engine/server/sv_cmds.c

@ -468,30 +468,6 @@ void SV_Kick_f( void )
SV_DropClient( cl, false ); SV_DropClient( cl, false );
} }
/*
==================
SV_Kill_f
==================
*/
void SV_Kill_f( void )
{
sv_client_t *cl;
if(( cl = SV_SetPlayer( )) == NULL )
return;
if( !SV_IsValidEdict( cl->edict ))
return;
if( cl->edict->v.health <= 0.0f )
{
SV_ClientPrintf( cl, "Can't suicide - already dead!\n");
return;
}
svgame.dllFuncs.pfnClientKill( cl->edict );
}
/* /*
================== ==================
SV_EntPatch_f SV_EntPatch_f
@ -833,7 +809,6 @@ void SV_InitOperatorCommands( void )
{ {
Cmd_AddCommand( "heartbeat", SV_Heartbeat_f, "send a heartbeat to the master server" ); Cmd_AddCommand( "heartbeat", SV_Heartbeat_f, "send a heartbeat to the master server" );
Cmd_AddCommand( "kick", SV_Kick_f, "kick a player off the server by number or name" ); Cmd_AddCommand( "kick", SV_Kick_f, "kick a player off the server by number or name" );
Cmd_AddCommand( "kill", SV_Kill_f, "die instantly" );
Cmd_AddCommand( "status", SV_Status_f, "print server status information" ); Cmd_AddCommand( "status", SV_Status_f, "print server status information" );
Cmd_AddCommand( "localinfo", SV_LocalInfo_f, "examine or change the localinfo string" ); Cmd_AddCommand( "localinfo", SV_LocalInfo_f, "examine or change the localinfo string" );
Cmd_AddCommand( "serverinfo", SV_ServerInfo_f, "examine or change the serverinfo string" ); Cmd_AddCommand( "serverinfo", SV_ServerInfo_f, "examine or change the serverinfo string" );
@ -866,12 +841,8 @@ SV_KillOperatorCommands
*/ */
void SV_KillOperatorCommands( void ) void SV_KillOperatorCommands( void )
{ {
Cvar_Reset( "public" );
Cvar_Reset( "sv_lan" );
Cmd_RemoveCommand( "heartbeat" ); Cmd_RemoveCommand( "heartbeat" );
Cmd_RemoveCommand( "kick" ); Cmd_RemoveCommand( "kick" );
Cmd_RemoveCommand( "kill" );
Cmd_RemoveCommand( "status" ); Cmd_RemoveCommand( "status" );
Cmd_RemoveCommand( "localinfo" ); Cmd_RemoveCommand( "localinfo" );
Cmd_RemoveCommand( "serverinfo" ); Cmd_RemoveCommand( "serverinfo" );

Loading…
Cancel
Save