Browse Source

engine: server: restore sv_trace_messages from old engine

pull/2/head
Alibek Omarov 3 years ago
parent
commit
2fa964e939
  1. 2
      engine/server/server.h
  2. 18
      engine/server/sv_game.c
  3. 3
      engine/server/sv_main.c

2
engine/server/server.h

@ -325,6 +325,7 @@ typedef struct
qboolean msg_started; // to avoid recursive included messages qboolean msg_started; // to avoid recursive included messages
edict_t *msg_ent; // user message member entity edict_t *msg_ent; // user message member entity
vec3_t msg_org; // user message member origin vec3_t msg_org; // user message member origin
qboolean msg_trace; // trace this message
void *hInstance; // pointer to game.dll void *hInstance; // pointer to game.dll
qboolean config_executed; // should to execute config.cfg once time to restore FCVAR_ARCHIVE that specified in hl.dll qboolean config_executed; // should to execute config.cfg once time to restore FCVAR_ARCHIVE that specified in hl.dll
@ -431,6 +432,7 @@ extern convar_t sv_skyvec_z;
extern convar_t sv_consistency; extern convar_t sv_consistency;
extern convar_t sv_password; extern convar_t sv_password;
extern convar_t sv_uploadmax; extern convar_t sv_uploadmax;
extern convar_t sv_trace_messages;
extern convar_t deathmatch; extern convar_t deathmatch;
extern convar_t hostname; extern convar_t hostname;
extern convar_t skill; extern convar_t skill;

18
engine/server/sv_game.c

@ -2608,6 +2608,13 @@ void GAME_EXPORT pfnMessageBegin( int msg_dest, int msg_num, const float *pOrigi
svgame.msg_realsize = 0; svgame.msg_realsize = 0;
svgame.msg_dest = msg_dest; svgame.msg_dest = msg_dest;
svgame.msg_ent = ed; svgame.msg_ent = ed;
// enable message tracing
svgame.msg_trace = sv_trace_messages.value != 0 &&
msg_num > svc_lastmsg &&
Q_strcmp( svgame.msg_name, "ReqState" );
if( svgame.msg_trace ) Con_Printf( "^3%s( %i, %s )\n", __FUNCTION__, msg_dest, svgame.msg_name );
} }
/* /*
@ -2706,6 +2713,8 @@ void GAME_EXPORT pfnMessageEnd( void )
svgame.msg_dest = bound( MSG_BROADCAST, svgame.msg_dest, MSG_SPEC ); svgame.msg_dest = bound( MSG_BROADCAST, svgame.msg_dest, MSG_SPEC );
SV_Multicast( svgame.msg_dest, org, svgame.msg_ent, true, false ); SV_Multicast( svgame.msg_dest, org, svgame.msg_ent, true, false );
if( svgame.msg_trace ) Con_Printf( "^3%s()\n", __FUNCTION__, svgame.msg_dest, svgame.msg_name );
} }
/* /*
@ -2718,6 +2727,7 @@ void GAME_EXPORT pfnWriteByte( int iValue )
{ {
if( iValue == -1 ) iValue = 0xFF; // convert char to byte if( iValue == -1 ) iValue = 0xFF; // convert char to byte
MSG_WriteByte( &sv.multicast, (byte)iValue ); MSG_WriteByte( &sv.multicast, (byte)iValue );
if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )", __FUNCTION__, iValue );
svgame.msg_realsize++; svgame.msg_realsize++;
} }
@ -2730,6 +2740,7 @@ pfnWriteChar
void GAME_EXPORT pfnWriteChar( int iValue ) void GAME_EXPORT pfnWriteChar( int iValue )
{ {
MSG_WriteChar( &sv.multicast, (signed char)iValue ); MSG_WriteChar( &sv.multicast, (signed char)iValue );
if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )", __FUNCTION__, iValue );
svgame.msg_realsize++; svgame.msg_realsize++;
} }
@ -2742,6 +2753,7 @@ pfnWriteShort
void GAME_EXPORT pfnWriteShort( int iValue ) void GAME_EXPORT pfnWriteShort( int iValue )
{ {
MSG_WriteShort( &sv.multicast, (short)iValue ); MSG_WriteShort( &sv.multicast, (short)iValue );
if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )", __FUNCTION__, iValue );
svgame.msg_realsize += 2; svgame.msg_realsize += 2;
} }
@ -2754,6 +2766,7 @@ pfnWriteLong
void GAME_EXPORT pfnWriteLong( int iValue ) void GAME_EXPORT pfnWriteLong( int iValue )
{ {
MSG_WriteLong( &sv.multicast, iValue ); MSG_WriteLong( &sv.multicast, iValue );
if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )", __FUNCTION__, iValue );
svgame.msg_realsize += 4; svgame.msg_realsize += 4;
} }
@ -2769,6 +2782,7 @@ void GAME_EXPORT pfnWriteAngle( float flValue )
int iAngle = ((int)(( flValue ) * 256 / 360) & 255); int iAngle = ((int)(( flValue ) * 256 / 360) & 255);
MSG_WriteChar( &sv.multicast, iAngle ); MSG_WriteChar( &sv.multicast, iAngle );
if( svgame.msg_trace ) Con_Printf( "\t^3%s( %f )", __FUNCTION__, flValue );
svgame.msg_realsize += 1; svgame.msg_realsize += 1;
} }
@ -2781,6 +2795,7 @@ pfnWriteCoord
void GAME_EXPORT pfnWriteCoord( float flValue ) void GAME_EXPORT pfnWriteCoord( float flValue )
{ {
MSG_WriteCoord( &sv.multicast, flValue ); MSG_WriteCoord( &sv.multicast, flValue );
if( svgame.msg_trace ) Con_Printf( "\t^3%s( %f )", __FUNCTION__, flValue );
svgame.msg_realsize += 2; svgame.msg_realsize += 2;
} }
@ -2793,6 +2808,7 @@ pfnWriteBytes
void pfnWriteBytes( const byte *bytes, int count ) void pfnWriteBytes( const byte *bytes, int count )
{ {
MSG_WriteBytes( &sv.multicast, bytes, count ); MSG_WriteBytes( &sv.multicast, bytes, count );
if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )", __FUNCTION__, count );
svgame.msg_realsize += count; svgame.msg_realsize += count;
} }
@ -2854,6 +2870,7 @@ void GAME_EXPORT pfnWriteString( const char *src )
*dst = '\0'; // string end (not included in count) *dst = '\0'; // string end (not included in count)
MSG_WriteString( &sv.multicast, string ); MSG_WriteString( &sv.multicast, string );
if( svgame.msg_trace ) Con_Printf( "\t^3%s( %s )", __FUNCTION__, string );
// NOTE: some messages with constant string length can be marked as known sized // NOTE: some messages with constant string length can be marked as known sized
svgame.msg_realsize += len; svgame.msg_realsize += len;
@ -2870,6 +2887,7 @@ void GAME_EXPORT pfnWriteEntity( int iValue )
if( iValue < 0 || iValue >= svgame.numEntities ) if( iValue < 0 || iValue >= svgame.numEntities )
Host_Error( "MSG_WriteEntity: invalid entnumber %i\n", iValue ); Host_Error( "MSG_WriteEntity: invalid entnumber %i\n", iValue );
MSG_WriteShort( &sv.multicast, (short)iValue ); MSG_WriteShort( &sv.multicast, (short)iValue );
if( svgame.msg_trace ) Con_Printf( "\t^3%s( %i )", __FUNCTION__, iValue );
svgame.msg_realsize += 2; svgame.msg_realsize += 2;
} }

3
engine/server/sv_main.c

@ -55,6 +55,7 @@ CVAR_DEFINE_AUTO( mp_logecho, "1", 0, "log multiplayer frags to server logfile"
CVAR_DEFINE_AUTO( mp_logfile, "1", 0, "log multiplayer frags to console" ); CVAR_DEFINE_AUTO( mp_logfile, "1", 0, "log multiplayer frags to console" );
CVAR_DEFINE_AUTO( sv_log_singleplayer, "0", FCVAR_ARCHIVE, "allows logging in singleplayer games" ); CVAR_DEFINE_AUTO( sv_log_singleplayer, "0", FCVAR_ARCHIVE, "allows logging in singleplayer games" );
CVAR_DEFINE_AUTO( sv_log_onefile, "0", FCVAR_ARCHIVE, "logs server information to only one file" ); CVAR_DEFINE_AUTO( sv_log_onefile, "0", FCVAR_ARCHIVE, "logs server information to only one file" );
CVAR_DEFINE_AUTO( sv_trace_messages, "0", FCVAR_LATCH, "enable server usermessages tracing (good for developers)" );
// game-related cvars // game-related cvars
CVAR_DEFINE_AUTO( mapcyclefile, "mapcycle.txt", 0, "name of multiplayer map cycle configuration file" ); CVAR_DEFINE_AUTO( mapcyclefile, "mapcycle.txt", 0, "name of multiplayer map cycle configuration file" );
@ -946,6 +947,8 @@ void SV_Init( void )
Cvar_RegisterVariable( &listipcfgfile ); Cvar_RegisterVariable( &listipcfgfile );
Cvar_RegisterVariable( &mapchangecfgfile ); Cvar_RegisterVariable( &mapchangecfgfile );
Cvar_RegisterVariable( &sv_trace_messages );
sv_allow_joystick = Cvar_Get( "sv_allow_joystick", "1", FCVAR_ARCHIVE, "allow connect with joystick enabled" ); sv_allow_joystick = Cvar_Get( "sv_allow_joystick", "1", FCVAR_ARCHIVE, "allow connect with joystick enabled" );
sv_allow_mouse = Cvar_Get( "sv_allow_mouse", "1", FCVAR_ARCHIVE, "allow connect with mouse" ); sv_allow_mouse = Cvar_Get( "sv_allow_mouse", "1", FCVAR_ARCHIVE, "allow connect with mouse" );
sv_allow_touch = Cvar_Get( "sv_allow_touch", "1", FCVAR_ARCHIVE, "allow connect with touch controls" ); sv_allow_touch = Cvar_Get( "sv_allow_touch", "1", FCVAR_ARCHIVE, "allow connect with touch controls" );

Loading…
Cancel
Save