diff --git a/3rdparty/maintui b/3rdparty/maintui index 24343bb5..e5f143ee 160000 --- a/3rdparty/maintui +++ b/3rdparty/maintui @@ -1 +1 @@ -Subproject commit 24343bb53ee25431e6f0ad9542dfc84c35bba887 +Subproject commit e5f143ee3370bf9c897015b60bcefbdf2937187e diff --git a/3rdparty/mainui b/3rdparty/mainui index 731f0062..43a8c885 160000 --- a/3rdparty/mainui +++ b/3rdparty/mainui @@ -1 +1 @@ -Subproject commit 731f0062ff5cb69287cc25964cddc6fe6f2c5e6d +Subproject commit 43a8c8853c398386dd43bd27e892bf23087f0f55 diff --git a/common/net_api.h b/common/net_api.h index db2c7c10..3a8229df 100644 --- a/common/net_api.h +++ b/common/net_api.h @@ -27,7 +27,6 @@ // Set this flag for things like broadcast requests, etc. where the engine should not // kill the request hook after receiving the first response #define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 ) -#define FNETAPI_LEGACY_PROTOCOL ( 1<<1 ) // xash3d-fwgs extension struct net_response_s; typedef void (*net_api_response_func_t) ( struct net_response_s *response ); diff --git a/engine/client/cl_debug.c b/engine/client/cl_debug.c index 4e1c4059..3ac59899 100644 --- a/engine/client/cl_debug.c +++ b/engine/client/cl_debug.c @@ -57,9 +57,6 @@ const char *CL_MsgInfo( int cmd ) case PROTO_CURRENT: svc_string = svc_strings[cmd]; break; - case PROTO_LEGACY: - svc_string = svc_legacy_strings[cmd]; - break; case PROTO_QUAKE: svc_string = svc_quake_strings[cmd]; break; diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index 10b76b73..f14da554 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -117,8 +117,6 @@ static int CL_GetDemoNetProtocol( connprotocol_t proto ) { case PROTO_CURRENT: return PROTOCOL_VERSION; - case PROTO_LEGACY: - return PROTOCOL_LEGACY_VERSION; case PROTO_QUAKE: return PROTOCOL_VERSION_QUAKE; case PROTO_GOLDSRC: @@ -134,8 +132,6 @@ static connprotocol_t CL_GetProtocolFromDemo( int net_protocol ) { case PROTOCOL_VERSION: return PROTO_CURRENT; - case PROTOCOL_LEGACY_VERSION: - return PROTO_LEGACY; case PROTOCOL_VERSION_QUAKE: return PROTO_QUAKE; case PROTOCOL_GOLDSRC_VERSION_DEMO: @@ -1264,8 +1260,7 @@ int GAME_EXPORT CL_GetDemoComment( const char *demoname, char *comment ) return false; } - if(( demohdr.net_protocol != PROTOCOL_VERSION && - demohdr.net_protocol != PROTOCOL_LEGACY_VERSION ) || + if( demohdr.net_protocol != PROTOCOL_VERSION || demohdr.dem_protocol != DEMO_PROTOCOL ) { FS_Close( demfile ); @@ -1480,10 +1475,10 @@ static qboolean CL_ParseDemoHeader( const char *callee, const char *filename, fi return false; } - if( hdr->net_protocol != PROTOCOL_VERSION && hdr->net_protocol != PROTOCOL_LEGACY_VERSION && hdr->net_protocol != PROTOCOL_GOLDSRC_VERSION_DEMO ) + if( hdr->net_protocol != PROTOCOL_VERSION && hdr->net_protocol != PROTOCOL_GOLDSRC_VERSION_DEMO ) { Con_Printf( S_ERROR "%s: net protocol outdated (%i should be %i or %i)\n", - callee, hdr->net_protocol, PROTOCOL_VERSION, PROTOCOL_LEGACY_VERSION ); + callee, hdr->net_protocol, PROTOCOL_VERSION, PROTOCOL_GOLDSRC_VERSION ); return false; } diff --git a/engine/client/cl_events.c b/engine/client/cl_events.c index 9639409a..f9122fd2 100644 --- a/engine/client/cl_events.c +++ b/engine/client/cl_events.c @@ -436,9 +436,8 @@ void CL_ParseEvent( sizebuf_t *msg, connprotocol_t proto ) if( proto == PROTO_GOLDSRC ) entity_bits = MAX_GOLDSRC_ENTITY_BITS; - else if( proto == PROTO_LEGACY ) - entity_bits = MAX_LEGACY_ENTITY_BITS; - else entity_bits = MAX_ENTITY_BITS; + else + entity_bits = MAX_ENTITY_BITS; // parse events queue for( i = 0 ; i < num_events; i++ ) diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index 299d4d93..605f8eb4 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -157,13 +157,6 @@ static qboolean CL_EntityCustomLerp( cl_entity_t *e ) case MOVETYPE_FLY: case MOVETYPE_COMPOUND: return false; - - // ABSOLUTELY STUPID HACK TO ALLOW MONSTERS - // INTERPOLATION IN GRAVGUNMOD COOP - // MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT - case MOVETYPE_TOSS: - if( cls.legacymode == PROTO_LEGACY && e->model && e->model->type == mod_studio ) - return false; } return true; @@ -653,18 +646,9 @@ FRAME PARSING */ static qboolean CL_ParseEntityNumFromPacket( sizebuf_t *msg, int *newnum, connprotocol_t proto ) { - if( proto == PROTO_LEGACY ) - { - *newnum = MSG_ReadWord( msg ); - if( *newnum == 0 ) - return false; - } - else - { - *newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS ); - if( *newnum == LAST_EDICT ) - return false; - } + *newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS ); + if( *newnum == LAST_EDICT ) + return false; return true; } @@ -831,9 +815,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto CL_WriteDemoJumpTime(); // sentinel count. save it for debug checking - if( proto == PROTO_LEGACY ) - count = MSG_ReadWord( msg ); - else count = MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1; + count = MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1; newframe = &cl.frames[cl.parsecountmod]; @@ -1246,16 +1228,6 @@ static void CL_LinkPacketEntities( frame_t *frame ) if( !CL_InterpolateModel( ent )) continue; } -#if 0 - // ABSOLUTELY STUPID HACK TO ALLOW MONSTERS - // INTERPOLATION IN GRAVGUNMOD COOP - // MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT - else if( cls.legacymode == PROTO_LEGACY && ent->model->type == mod_studio && ent->curstate.movetype == MOVETYPE_TOSS ) - { - if( !CL_InterpolateModel( ent )) - continue; - } -#endif else { // no interpolation right now diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index d5ea0b47..b64883d7 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -3481,7 +3481,7 @@ static void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags, nr->flags = flags; // local servers request - Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, A2A_NETINFO" %i %i %i", FBitSet( flags, FNETAPI_LEGACY_PROTOCOL ) ? PROTOCOL_LEGACY_VERSION : PROTOCOL_VERSION, context, request ); + Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, A2A_NETINFO" %i %i %i", PROTOCOL_VERSION, context, request ); } /* diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 8bde6fa1..6df4d437 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -780,10 +780,6 @@ static void CL_WritePacket( void ) maxbackup = MAX_GOLDSRC_BACKUP_CMDS; maxcmds = MAX_GOLDSRC_TOTAL_CMDS; break; - case PROTO_LEGACY: - maxbackup = MAX_LEGACY_BACKUP_CMDS; - maxcmds = MAX_LEGACY_TOTAL_CMDS; - break; default: maxbackup = MAX_BACKUP_COMMANDS; maxcmds = MAX_TOTAL_CMDS; @@ -1125,10 +1121,6 @@ static void CL_SendConnectPacket( connprotocol_t proto, int challenge ) Info_SetValueForKey( protinfo, "raw", "steam", sizeof( protinfo )); CL_GetCDKey( protinfo, sizeof( protinfo )); - // remove keys set for legacy protocol - Info_RemoveKey( cls.userinfo, "cl_maxpacket" ); - Info_RemoveKey( cls.userinfo, "cl_maxpayload" ); - name = Info_ValueForKey( cls.userinfo, "name" ); if( cl_advertise_engine_in_name.value && Q_strnicmp( name, "[Xash3D]", 8 )) Info_SetValueForKeyf( cls.userinfo, "name", sizeof( cls.userinfo ), "[Xash3D]%s", name ); @@ -1146,27 +1138,6 @@ static void CL_SendConnectPacket( connprotocol_t proto, int challenge ) NET_SendPacket( NS_CLIENT, MSG_GetNumBytesWritten( &send ), MSG_GetData( &send ), adr ); Con_Printf( "Trying to connect with GoldSrc 48 protocol\n" ); } - else if( proto == PROTO_LEGACY ) - { - const char *dlmax; - int qport = Cvar_VariableInteger( "net_qport" ); - - // reset nickname from cvar value - Info_SetValueForKey( cls.userinfo, "name", name.string, sizeof( cls.userinfo )); - - // set related userinfo keys - dlmax = ( cl_dlmax.value >= 100 && cl_dlmax.value < 40000 ) ? cl_dlmax.string : "1400"; - Info_SetValueForKey( cls.userinfo, "cl_maxpacket", dlmax, sizeof( cls.userinfo )); - - if( !COM_CheckStringEmpty( Info_ValueForKey( cls.userinfo, "cl_maxpayload" ))) - Info_SetValueForKey( cls.userinfo, "cl_maxpayload", "1000", sizeof( cls.userinfo ) ); - - Info_SetValueForKey( protinfo, "i", key, sizeof( protinfo )); - - Netchan_OutOfBandPrint( NS_CLIENT, adr, C2S_CONNECT" %i %i %i \"%s\" %d \"%s\"\n", - PROTOCOL_LEGACY_VERSION, qport, challenge, cls.userinfo, NET_LEGACY_EXT_SPLIT, protinfo ); - Con_Printf( "Trying to connect with legacy protocol\n" ); - } else { const char *qport = Cvar_VariableString( "net_qport" ); @@ -1178,10 +1149,6 @@ static void CL_SendConnectPacket( connprotocol_t proto, int challenge ) if( cl_dlmax.value > FRAGMENT_MAX_SIZE || cl_dlmax.value < FRAGMENT_MIN_SIZE ) Cvar_DirectSetValue( &cl_dlmax, FRAGMENT_DEFAULT_SIZE ); - // remove keys set for legacy protocol - Info_RemoveKey( cls.userinfo, "cl_maxpacket" ); - Info_RemoveKey( cls.userinfo, "cl_maxpayload" ); - Info_SetValueForKey( protinfo, "uuid", key, sizeof( protinfo )); Info_SetValueForKey( protinfo, "qport", qport, sizeof( protinfo )); Info_SetValueForKeyf( protinfo, "ext", sizeof( protinfo ), "%d", extensions); @@ -1423,12 +1390,6 @@ static qboolean CL_StringToProtocol( const char *s, connprotocol_t *proto ) return true; } - if( !Q_stricmp( s, "legacy" ) || !Q_strcmp( s, "48" )) - { - *proto = PROTO_LEGACY; - return true; - } - if( !Q_stricmp( s, "goldsrc" ) || !Q_stricmp( s, "gs" )) { *proto = PROTO_GOLDSRC; @@ -1436,7 +1397,7 @@ static qboolean CL_StringToProtocol( const char *s, connprotocol_t *proto ) } // quake protocol only used for demos - Con_Printf( "Unknown protocol. Supported are: 49 (current), 48 (legacy), gs (goldsrc)\n" ); + Con_Printf( "Unknown protocol. Supported are: 49 (current), gs (goldsrc)\n" ); return false; } @@ -1647,13 +1608,6 @@ void CL_SetupNetchanForProtocol( connprotocol_t proto ) SetBits( flags, NETCHAN_USE_MUNGE | NETCHAN_USE_BZIP2 | NETCHAN_GOLDSRC ); pfnBlockSize = CL_GetGoldSrcFragmentSize; break; - case PROTO_LEGACY: - if( FBitSet( Q_atoi( Cmd_Argv( 1 )), NET_LEGACY_EXT_SPLIT )) - { - SetBits( flags, NETCHAN_USE_LEGACY_SPLIT ); - Con_Reportf( "^2NET_EXT_SPLIT enabled^7 (packet sizes is %d/%d)\n", (int)cl_dlmax.value, 65536 ); - } - break; default: if( !Host_IsLocalClient( )) SetBits( flags, NETCHAN_USE_LZSS ); @@ -1832,9 +1786,6 @@ static void CL_QueryServer( netadr_t adr, connprotocol_t proto ) case PROTO_GOLDSRC: Netchan_OutOfBand( NS_CLIENT, adr, sizeof( A2S_GOLDSRC_INFO ), A2S_GOLDSRC_INFO ); // includes null terminator! break; - case PROTO_LEGACY: - Netchan_OutOfBandPrint( NS_CLIENT, adr, A2A_INFO" %i", PROTOCOL_LEGACY_VERSION ); - break; case PROTO_CURRENT: Netchan_OutOfBandPrint( NS_CLIENT, adr, A2A_INFO" %i", PROTOCOL_VERSION ); break; @@ -1982,14 +1933,6 @@ static void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg ) static char infostring[512+8]; char *s = MSG_ReadString( msg ); int i; - const char *magic = ": wrong version\n", *p; - size_t len = Q_strlen( s ), magiclen = Q_strlen( magic ); - - if( len >= magiclen && !Q_strcmp( s + len - magiclen, magic )) - { - Netchan_OutOfBandPrint( NS_CLIENT, from, A2A_INFO" %i", PROTOCOL_LEGACY_VERSION ); - return; - } if( !Info_IsValid( s )) { @@ -2004,17 +1947,6 @@ static void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg ) Info_RemoveKey( infostring, "gs" ); // don't let servers pretend they're something else - p = Info_ValueForKey( infostring, "p" ); - if( !COM_CheckStringEmpty( p )) - { - Info_SetValueForKey( infostring, "legacy", "1", sizeof( infostring )); - Info_SetValueForKey( infostring, "p", "48", sizeof( infostring )); - } - else if( !Q_strcmp( p, "48" )) - { - Info_SetValueForKey( infostring, "legacy", "1", sizeof( infostring )); - } - UI_AddServerToList( from, infostring ); } @@ -2667,9 +2599,6 @@ static void CL_ReadNetMessage( void ) switch( cls.legacymode ) { - case PROTO_LEGACY: - parsefn = CL_ParseLegacyServerMessage; - break; case PROTO_QUAKE: parsefn = CL_ParseQuakeMessage; break; @@ -2683,14 +2612,6 @@ static void CL_ReadNetMessage( void ) while( CL_GetMessage( net_message_buffer, &curSize )) { - const int split_header = LittleLong( 0xFFFFFFFE ); - if( cls.legacymode == PROTO_LEGACY && !memcmp( &split_header, net_message_buffer, sizeof( split_header ))) - { - // Will rewrite existing packet by merged - if( !NetSplit_GetLong( &cls.netchan.netsplit, &net_from, net_message_buffer, &curSize ) ) - continue; - } - MSG_Init( &net_message, "ServerData", net_message_buffer, curSize ); // check for connectionless packet (0xffffffff) first @@ -2902,19 +2823,6 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename ) Con_Printf( S_ERROR "server failed to transmit file '%s'\n", CL_CleanFileName( filename )); } - if( cls.legacymode == PROTO_LEGACY ) - { - if( host.downloadcount > 0 ) - host.downloadcount--; - - if( !host.downloadcount ) - { - MSG_WriteByte( &cls.netchan.message, clc_stringcmd ); - MSG_WriteString( &cls.netchan.message, "continueloading" ); - } - return; - } - for( p = cl.resourcesneeded.pNext; p != &cl.resourcesneeded; p = p->pNext ) { if( !Q_strnicmp( filename, "!MD5", 4 )) @@ -3053,13 +2961,6 @@ void CL_UpdateInfo( const char *key, const char *value ) { switch( cls.legacymode ) { - case PROTO_LEGACY: - if( cls.state != ca_active ) - break; - - MSG_BeginClientCmd( &cls.netchan.message, clc_legacy_userinfo ); - MSG_WriteString( &cls.netchan.message, cls.userinfo ); - break; case PROTO_GOLDSRC: if( cl_advertise_engine_in_name.value && !Q_stricmp( key, "name" ) && Q_strnicmp( value, "[Xash3D]", 8 )) { @@ -3516,7 +3417,6 @@ static void CL_InitLocal( void ) Cmd_AddCommand ("reconnect", CL_Reconnect_f, "reconnect to current level" ); Cmd_AddCommand ("rcon", CL_Rcon_f, "sends a command to the server console (rcon_password and rcon_address required)" ); - Cmd_AddCommand ("precache", CL_LegacyPrecache_f, "legacy server compatibility" ); Cmd_AddCommand( "richpresence_gamemode", Cmd_Null_f, "compatibility command, does nothing" ); Cmd_AddCommand( "richpresence_update", Cmd_Null_f, "compatibility command, does nothing" ); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 9facfad9..e364a112 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -866,10 +866,6 @@ void CL_ParseServerData( sizebuf_t *msg, connprotocol_t proto ) switch( proto ) { - case PROTO_LEGACY: - required_version = PROTOCOL_LEGACY_VERSION; - Con_Reportf( "Legacy serverdata packet received.\n" ); - break; case PROTO_GOLDSRC: required_version = PROTOCOL_GOLDSRC_VERSION; Con_Reportf( "GoldSrc serverdata packet received.\n" ); @@ -925,7 +921,7 @@ void CL_ParseServerData( sizebuf_t *msg, connprotocol_t proto ) background = false; clgame.maxEntities = GI->max_edicts + (( cl.maxclients - 1 ) * 15 ); - clgame.maxEntities = bound( MIN_LEGACY_EDICTS, clgame.maxEntities, MAX_GOLDSRC_EDICTS ); + clgame.maxEntities = Q_min( clgame.maxEntities, MAX_GOLDSRC_EDICTS ); clgame.maxModels = 512; // ??? Q_strncpy( clgame.maptitle, clgame.mapname, sizeof( clgame.maptitle )); @@ -933,37 +929,22 @@ void CL_ParseServerData( sizebuf_t *msg, connprotocol_t proto ) } else { - uint32_t mask; - cl.playernum = MSG_ReadByte( msg ); cl.maxclients = MSG_ReadByte( msg ); clgame.maxEntities = MSG_ReadWord( msg ); - if( proto == PROTO_LEGACY ) - { - clgame.maxEntities = bound( MIN_LEGACY_EDICTS, clgame.maxEntities, MAX_LEGACY_EDICTS ); - clgame.maxModels = 512; // ??? - mask = ENGINE_LEGACY_FEATURES_MASK; - } - else - { - clgame.maxEntities = bound( MIN_EDICTS, clgame.maxEntities, MAX_EDICTS ); - clgame.maxModels = MSG_ReadWord( msg ); - mask = ENGINE_FEATURES_MASK; - } + clgame.maxEntities = bound( MIN_EDICTS, clgame.maxEntities, MAX_EDICTS ); + clgame.maxModels = MSG_ReadWord( msg ); Q_strncpy( clgame.mapname, MSG_ReadString( msg ), sizeof( clgame.mapname )); Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), sizeof( clgame.maptitle )); background = MSG_ReadOneBit( msg ); Q_strncpy( gamefolder, MSG_ReadString( msg ), sizeof( gamefolder )); - Host_ValidateEngineFeatures( mask, MSG_ReadDword( msg )); + Host_ValidateEngineFeatures( ENGINE_FEATURES_MASK, MSG_ReadDword( msg )); - if( proto != PROTO_LEGACY ) + // receive the player hulls + for( i = 0; i < MAX_MAP_HULLS * 3; i++ ) { - // receive the player hulls - for( i = 0; i < MAX_MAP_HULLS * 3; i++ ) - { - host.player_mins[i/3][i%3] = MSG_ReadChar( msg ); - host.player_maxs[i/3][i%3] = MSG_ReadChar( msg ); - } + host.player_mins[i/3][i%3] = MSG_ReadChar( msg ); + host.player_maxs[i/3][i%3] = MSG_ReadChar( msg ); } } @@ -1061,7 +1042,7 @@ void CL_ParseServerData( sizebuf_t *msg, connprotocol_t proto ) { CL_ServerCommand( true, "sendres" ); } - else if( proto != PROTO_LEGACY ) + else { CL_ServerCommand( true, "sendres %i\n", cl.servercount ); } @@ -1222,7 +1203,7 @@ void CL_ParseClientData( sizebuf_t *msg, connprotocol_t proto ) if( !MSG_ReadOneBit( msg )) break; // read the weapon idx - idx = MSG_ReadUBitLong( msg, proto == PROTO_LEGACY ? MAX_LEGACY_WEAPON_BITS : MAX_WEAPON_BITS ); + idx = MSG_ReadUBitLong( msg, MAX_WEAPON_BITS ); if( proto == PROTO_GOLDSRC ) Delta_ReadGSFields( msg, DT_WEAPONDATA_T, &from_wd[idx], &to_wd[idx], cl.mtime[0] ); @@ -1255,11 +1236,7 @@ void CL_ParseBaseline( sizebuf_t *msg, connprotocol_t proto ) qboolean player; int newnum; - if( proto == PROTO_LEGACY ) - { - newnum = MSG_ReadWord( msg ); - } - else if( proto == PROTO_GOLDSRC ) + if( proto == PROTO_GOLDSRC ) { uint value = MSG_ReadWord( msg ); @@ -1296,26 +1273,18 @@ void CL_ParseBaseline( sizebuf_t *msg, connprotocol_t proto ) ent->baseline.entityType = type; } else MSG_ReadDeltaEntity( msg, &nullstate, &ent->baseline, newnum, player, 1.0f ); - - if( proto == PROTO_LEGACY ) - break; // only one baseline allowed in legacy protocol } - if( proto != PROTO_LEGACY ) + cl.instanced_baseline_count = MSG_ReadUBitLong( msg, 6 ); + + for( int i = 0; i < cl.instanced_baseline_count; i++ ) { - int i; - - cl.instanced_baseline_count = MSG_ReadUBitLong( msg, 6 ); - - for( i = 0; i < cl.instanced_baseline_count; i++ ) + if( proto == PROTO_GOLDSRC ) + Delta_ReadGSFields( msg, DT_ENTITY_STATE_T, &nullstate, &cl.instanced_baseline[i], 1.0f ); + else { - if( proto == PROTO_GOLDSRC ) - Delta_ReadGSFields( msg, DT_ENTITY_STATE_T, &nullstate, &cl.instanced_baseline[i], 1.0f ); - else - { - int newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS ); - MSG_ReadDeltaEntity( msg, &nullstate, &cl.instanced_baseline[i], newnum, false, 1.0f ); - } + int newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS ); + MSG_ReadDeltaEntity( msg, &nullstate, &cl.instanced_baseline[i], newnum, false, 1.0f ); } } } @@ -1435,7 +1404,7 @@ void CL_RegisterUserMessage( sizebuf_t *msg, connprotocol_t proto ) int size; int svc_num = MSG_ReadByte( msg ); - if( proto == PROTO_LEGACY || proto == PROTO_GOLDSRC ) + if( proto == PROTO_GOLDSRC ) { size = MSG_ReadByte( msg ); if( size == UINT8_MAX ) @@ -1478,12 +1447,6 @@ void CL_UpdateUserinfo( sizebuf_t *msg, connprotocol_t proto ) id = MSG_ReadLong( msg ); active = true; } - else if( proto == PROTO_LEGACY ) - { - slot = MSG_ReadUBitLong( msg, MAX_CLIENT_BITS ); - id = 0; // bogus - active = MSG_ReadOneBit( msg ) ? true : false; - } else { slot = MSG_ReadUBitLong( msg, MAX_CLIENT_BITS ); @@ -1504,8 +1467,7 @@ void CL_UpdateUserinfo( sizebuf_t *msg, connprotocol_t proto ) player->topcolor = Q_atoi( Info_ValueForKey( player->userinfo, "topcolor" )); player->bottomcolor = Q_atoi( Info_ValueForKey( player->userinfo, "bottomcolor" )); player->spectator = Q_atoi( Info_ValueForKey( player->userinfo, "*hltv" )); - if( proto != PROTO_LEGACY ) - MSG_ReadBytes( msg, player->hashedcdkey, sizeof( player->hashedcdkey )); + MSG_ReadBytes( msg, player->hashedcdkey, sizeof( player->hashedcdkey )); if( proto == PROTO_GOLDSRC && ( !COM_CheckStringEmpty( player->userinfo ) || !COM_CheckStringEmpty( player->name ))) active = false; @@ -2254,10 +2216,6 @@ void CL_ParseCvarValue( sizebuf_t *msg, const qboolean ext, const connprotocol_t else response = cvar->string; } - else if( proto == PROTO_LEGACY ) - { - response = "Not Found"; - } else { response = "Bad CVAR request"; @@ -2414,7 +2372,7 @@ void CL_ParseUserMessage( sizebuf_t *msg, int svc_num, connprotocol_t proto ) // message with variable sizes receive an actual size as first byte if( iSize == -1 ) { - if( proto == PROTO_GOLDSRC || proto == PROTO_LEGACY ) + if( proto == PROTO_GOLDSRC ) iSize = MSG_ReadByte( msg ); else iSize = MSG_ReadWord( msg ); } diff --git a/engine/client/cl_parse_48.c b/engine/client/cl_parse_48.c deleted file mode 100644 index 29ec46b4..00000000 --- a/engine/client/cl_parse_48.c +++ /dev/null @@ -1,634 +0,0 @@ -/* -cl_parse.c - parse a message received from the server -Copyright (C) 2008 Uncle Mike - -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 3 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 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -*/ - -#include "common.h" -#include "client.h" -#include "net_encode.h" -#include "particledef.h" -#include "cl_tent.h" -#include "shake.h" -#include "hltv.h" -#include "input.h" - - -/* -================== -CL_ParseStaticEntity - -static client entity -================== -*/ -static void CL_LegacyParseStaticEntity( sizebuf_t *msg ) -{ - int i; - entity_state_t state = { 0 }; - cl_entity_t *ent; - - if( !clgame.static_entities ) - clgame.static_entities = Mem_Calloc( clgame.mempool, sizeof( cl_entity_t ) * MAX_STATIC_ENTITIES ); - - state.modelindex = MSG_ReadShort( msg ); - state.sequence = MSG_ReadByte( msg ); - state.frame = MSG_ReadByte( msg ); - state.colormap = MSG_ReadWord( msg ); - state.skin = MSG_ReadByte( msg ); - - for( i = 0; i < 3; i++ ) - { - state.origin[i] = MSG_ReadCoord( msg ); - state.angles[i] = MSG_ReadBitAngle( msg, 16 ); - } - - state.rendermode = MSG_ReadByte( msg ); - - if( state.rendermode != kRenderNormal ) - { - state.renderamt = MSG_ReadByte( msg ); - state.rendercolor.r = MSG_ReadByte( msg ); - state.rendercolor.g = MSG_ReadByte( msg ); - state.rendercolor.b = MSG_ReadByte( msg ); - state.renderfx = MSG_ReadByte( msg ); - } - - i = clgame.numStatics; - if( i >= MAX_STATIC_ENTITIES ) - { - Con_Printf( S_ERROR "MAX_STATIC_ENTITIES limit exceeded!\n" ); - return; - } - - ent = &clgame.static_entities[i]; - clgame.numStatics++; - - // all states are same - ent->baseline = ent->curstate = ent->prevstate = state; - ent->index = 0; // static entities doesn't has the numbers - - // statics may be respawned in game e.g. for demo recording - if( cls.state == ca_connected || cls.state == ca_validate ) - ent->trivial_accept = INVALID_HANDLE; - - // setup the new static entity - VectorCopy( ent->curstate.origin, ent->origin ); - VectorCopy( ent->curstate.angles, ent->angles ); - ent->model = CL_ModelHandle( state.modelindex ); - ent->curstate.framerate = 1.0f; - CL_ResetLatchedVars( ent, true ); - - if( ent->curstate.rendermode == kRenderNormal && ent->model != NULL ) - { - // auto 'solid' faces - if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && Host_IsQuakeCompatible( )) - { - ent->curstate.rendermode = kRenderTransAlpha; - ent->curstate.renderamt = 255; - } - } - - R_AddEfrags( ent ); // add link -} - -static void CL_LegacyParseSoundPacket( sizebuf_t *msg, qboolean is_ambient ) -{ - vec3_t pos; - int chan, sound; - float volume, attn; - int flags, pitch, entnum; - sound_t handle = 0; - - flags = MSG_ReadWord( msg ); - if( flags & SND_LEGACY_LARGE_INDEX ) - { - sound = MSG_ReadWord( msg ); - flags &= ~SND_LEGACY_LARGE_INDEX; - } - else - sound = MSG_ReadByte( msg ); - chan = MSG_ReadByte( msg ); - - if( FBitSet( flags, SND_VOLUME )) - volume = (float)MSG_ReadByte( msg ) / 255.0f; - else volume = VOL_NORM; - - if( FBitSet( flags, SND_ATTENUATION )) - attn = (float)MSG_ReadByte( msg ) / 64.0f; - else attn = ATTN_NONE; - - if( FBitSet( flags, SND_PITCH )) - pitch = MSG_ReadByte( msg ); - else pitch = PITCH_NORM; - - // entity reletive - entnum = MSG_ReadWord( msg ); - - // positioned in space - MSG_ReadVec3Coord( msg, pos ); - - if( FBitSet( flags, SND_SENTENCE )) - { - char sentenceName[32]; - Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound ); - handle = S_RegisterSound( sentenceName ); - } - else handle = cl.sound_index[sound]; // see precached sound - - if( !cl.audio_prepped ) - return; // too early - - // g-cont. sound and ambient sound have only difference with channel - if( is_ambient ) - { - S_AmbientSound( pos, entnum, handle, volume, attn, pitch, flags ); - } - else - { - S_StartSound( pos, entnum, chan, handle, volume, attn, pitch, flags ); - } -} -/* -================ -CL_PrecacheSound - -prceache sound from server -================ -*/ -static void CL_LegacyPrecacheSound( sizebuf_t *msg ) -{ - int soundIndex; - - soundIndex = MSG_ReadUBitLong( msg, MAX_SOUND_BITS ); - - if( soundIndex < 0 || soundIndex >= MAX_SOUNDS ) - Host_Error( "%s: bad soundindex %i\n", __func__, soundIndex ); - - Q_strncpy( cl.sound_precache[soundIndex], MSG_ReadString( msg ), sizeof( cl.sound_precache[0] )); - - // when we loading map all resources is precached sequentially - //if( !cl.audio_prepped ) return; - - cl.sound_index[soundIndex] = S_RegisterSound( cl.sound_precache[soundIndex] ); -} - -static void CL_LegacyPrecacheModel( sizebuf_t *msg ) -{ - int modelIndex; - string model; - - modelIndex = MSG_ReadUBitLong( msg, MAX_LEGACY_MODEL_BITS ); - - if( modelIndex < 0 || modelIndex >= MAX_MODELS ) - Host_Error( "%s: bad modelindex %i\n", __func__, modelIndex ); - - Q_strncpy( model, MSG_ReadString( msg ), sizeof( model )); - //Q_strncpy( cl.model_precache[modelIndex], BF_ReadString( msg ), sizeof( cl.model_precache[0] )); - - // when we loading map all resources is precached sequentially - //if( !cl.video_prepped ) return; - if( modelIndex == 1 && !cl.worldmodel ) - { - CL_ClearWorld (); - - cl.models[modelIndex] = cl.worldmodel = Mod_LoadWorld( model, true ); - return; - - } - - //Mod_RegisterModel( cl.model_precache[modelIndex], modelIndex ); - - cl.models[modelIndex] = Mod_ForName( model, false, false ); - cl.nummodels = Q_max( cl.nummodels, modelIndex ); -} - -static void CL_LegacyPrecacheEvent( sizebuf_t *msg ) -{ - int eventIndex; - - eventIndex = MSG_ReadUBitLong( msg, MAX_EVENT_BITS ); - - if( eventIndex < 0 || eventIndex >= MAX_EVENTS ) - Host_Error( "%s: bad eventindex %i\n", __func__, eventIndex ); - - Q_strncpy( cl.event_precache[eventIndex], MSG_ReadString( msg ), sizeof( cl.event_precache[0] )); - - // can be set now - CL_SetEventIndex( cl.event_precache[eventIndex], eventIndex ); -} - -#if XASH_LOW_MEMORY == 0 -#define MAX_LEGACY_RESOURCES 2048 -#elif XASH_LOW_MEMORY == 2 -#define MAX_LEGACY_RESOURCES 1 -#elif XASH_LOW_MEMORY == 1 -#define MAX_LEGACY_RESOURCES 512 -#endif -/* -============== -CL_ParseResourceList - -============== -*/ -static void CL_LegacyParseResourceList( sizebuf_t *msg ) -{ - int i = 0; - static struct - { - int rescount; - int restype[MAX_LEGACY_RESOURCES]; - char resnames[MAX_LEGACY_RESOURCES][MAX_QPATH]; - } reslist; - - memset( &reslist, 0, sizeof( reslist )); - reslist.rescount = MSG_ReadWord( msg ) - 1; - - if( reslist.rescount > MAX_LEGACY_RESOURCES ) - Host_Error( "MAX_RESOURCES reached\n" ); - - for( i = 0; i < reslist.rescount; i++ ) - { - reslist.restype[i] = MSG_ReadWord( msg ); - Q_strncpy( reslist.resnames[i], MSG_ReadString( msg ), sizeof( reslist.resnames[i] )); - } - - if( cls.demoplayback ) - return; - - if( !cl_allow_download.value ) - { - Con_DPrintf( "Refusing new resource, cl_allowdownload set to 0\n" ); - reslist.rescount = 0; - } - - if( cls.state == ca_active && !cl_download_ingame.value ) - { - Con_DPrintf( "Refusing new resource, cl_download_ingame set to 0\n" ); - reslist.rescount = 0; - } - - HTTP_ResetProcessState(); - - host.downloadcount = 0; - - for( i = 0; i < reslist.rescount; i++ ) - { - char soundpath[MAX_VA_STRING]; - const char *path; - - if( reslist.restype[i] == t_sound ) - { - Q_snprintf( soundpath, sizeof( soundpath ), DEFAULT_SOUNDPATH "%s", reslist.resnames[i] ); - - path = soundpath; - } - else path = reslist.resnames[i]; - - if( FS_FileExists( path, false )) - continue; // already exists - - host.downloadcount++; - HTTP_AddDownload( path, -1, true, NULL ); - } - - if( !host.downloadcount ) - { - MSG_WriteByte( &cls.netchan.message, clc_stringcmd ); - MSG_WriteString( &cls.netchan.message, "continueloading" ); - } -} - -/* -===================== -CL_ParseLegacyServerMessage - -dispatch messages -===================== -*/ -void CL_ParseLegacyServerMessage( sizebuf_t *msg ) -{ - size_t bufStart, playerbytes; - int cmd; - int old_background; - const char *s; - - // parse the message - while( 1 ) - { - if( MSG_CheckOverflow( msg )) - { - Host_Error( "%s: overflow!\n", __func__ ); - return; - } - - // mark start position - bufStart = MSG_GetNumBytesRead( msg ); - - // end of message (align bits) - if( MSG_GetNumBitsLeft( msg ) < 8 ) - break; - - cmd = MSG_ReadServerCmd( msg ); - - // record command for debugging spew on parse problem - CL_Parse_RecordCommand( cmd, bufStart ); - - if( CL_ParseCommonDLLMessage( msg, PROTO_LEGACY, cmd, bufStart )) - continue; - - // other commands - switch( cmd ) - { - case svc_bad: - Host_Error( "svc_bad\n" ); - break; - case svc_nop: - // this does nothing - break; - case svc_disconnect: - CL_Drop (); - Host_AbortCurrentFrame (); - break; - case svc_legacy_event: - CL_ParseEvent( msg, PROTO_LEGACY ); - cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart; - break; - case svc_legacy_changing: - old_background = cl.background; - if( MSG_ReadOneBit( msg )) - { - int maxclients = cl.maxclients; - - // we can only changelevel in singleplayer - // and singleplayer always runs in current protocol - // cls.changelevel = true; - S_StopAllSounds( true ); - - Con_Printf( "Server changing, reconnecting\n" ); - - if( cls.demoplayback ) - { - SCR_BeginLoadingPlaque( cl.background ); - cls.changedemo = true; - } - - CL_ClearState( ); - - // a1ba: need to restore cl.maxclients because engine chooses - // frame backups count depending on this value - // In general, it's incorrect to call CL_InitEdicts right after - // CL_ClearState because of this bug. Some time later this logic - // should be re-done. - CL_InitEdicts( maxclients ); // re-arrange edicts - } - else Con_Printf( "Server disconnected, reconnecting\n" ); - - if( cls.demoplayback ) - { - cl.background = (cls.demonum != -1) ? true : false; - cls.state = ca_connected; - } - else - { - // g-cont. local client skip the challenge - if( SV_Active( )) - cls.state = ca_disconnected; - else cls.state = ca_connecting; - cl.background = old_background; - cls.connect_time = MAX_HEARTBEAT; - memset( &cls.bandwidth_test, 0, sizeof( cls.bandwidth_test )); - cls.connect_retry = 0; - } - break; - case svc_setview: - CL_ParseViewEntity( msg ); - break; - case svc_sound: - CL_LegacyParseSoundPacket( msg, false ); - cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart; - break; - case svc_legacy_ambientsound: - CL_LegacyParseSoundPacket( msg, true ); - cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart; - - break; - case svc_time: - CL_ParseServerTime( msg, PROTO_LEGACY ); - break; - case svc_print: - Con_Printf( "%s", MSG_ReadString( msg )); - break; - case svc_stufftext: - s = MSG_ReadString( msg ); - if( cl_trace_stufftext.value ) - { - size_t len = Q_strlen( s ); - Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' ); - } - -#ifdef HACKS_RELATED_HLMODS - // disable Cry Of Fear antisave protection - if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS ) - break; // too early -#endif - Cbuf_AddFilteredText( s ); - break; - case svc_setangle: - CL_ParseSetAngle( msg ); - break; - case svc_serverdata: - Cbuf_Execute(); // make sure any stuffed commands are done - CL_ParseServerData( msg, PROTO_LEGACY ); - break; - case svc_lightstyle: - CL_ParseLightStyle( msg, PROTO_LEGACY ); - break; - case svc_updateuserinfo: - CL_UpdateUserinfo( msg, PROTO_LEGACY ); - break; - case svc_deltatable: - Delta_ParseTableField( msg ); - break; - case svc_clientdata: - CL_ParseClientData( msg, PROTO_LEGACY ); - cl.frames[cl.parsecountmod].graphdata.client += MSG_GetNumBytesRead( msg ) - bufStart; - break; - case svc_resource: - CL_ParseResource( msg ); - break; - case svc_pings: - CL_UpdateUserPings( msg ); - break; - case svc_particle: - CL_ParseParticles( msg, PROTO_LEGACY ); - break; - case svc_restoresound: - Con_Printf( S_ERROR "%s: svc_restoresound: implement me!\n", __func__ ); - break; - case svc_spawnstatic: - CL_LegacyParseStaticEntity( msg ); - break; - case svc_event_reliable: - CL_ParseReliableEvent( msg, PROTO_LEGACY ); - cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart; - break; - case svc_spawnbaseline: - CL_ParseBaseline( msg, PROTO_LEGACY ); - break; - case svc_setpause: - cl.paused = ( MSG_ReadOneBit( msg ) != 0 ); - break; - case svc_signonnum: - CL_ParseSignon( msg, PROTO_LEGACY ); - break; - case svc_centerprint: - CL_CenterPrint( MSG_ReadString( msg ), 0.25f ); - break; - case svc_legacy_modelindex: - CL_LegacyPrecacheModel( msg ); - break; - case svc_legacy_soundindex: - CL_LegacyPrecacheSound( msg ); - break; - case svc_restore: - CL_ParseRestore( msg ); - break; - case svc_legacy_eventindex: - CL_LegacyPrecacheEvent(msg); - break; - case svc_bspdecal: - CL_ParseStaticDecal( msg ); - break; - case svc_addangle: - CL_ParseAddAngle( msg ); - break; - case svc_usermessage: - CL_RegisterUserMessage( msg, PROTO_LEGACY ); - break; - case svc_packetentities: - playerbytes = CL_ParsePacketEntities( msg, false, PROTO_LEGACY ); - cl.frames[cl.parsecountmod].graphdata.players += playerbytes; - cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes; - break; - case svc_deltapacketentities: - playerbytes = CL_ParsePacketEntities( msg, true, PROTO_LEGACY ); - cl.frames[cl.parsecountmod].graphdata.players += playerbytes; - cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes; - break; - case svc_legacy_chokecount: - { - int i, j; - i = MSG_ReadByte( msg ); - j = cls.netchan.incoming_acknowledged - 1; - for( ; i > 0 && j > cls.netchan.outgoing_sequence - CL_UPDATE_BACKUP; j-- ) - { - if( cl.frames[j & CL_UPDATE_MASK].receivedtime != -3.0 ) - { - cl.frames[j & CL_UPDATE_MASK].choked = true; - cl.frames[j & CL_UPDATE_MASK].receivedtime = -2.0; - i--; - } - } - break; - } - //cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = true; - //cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].receivedtime = -2.0; - break; - case svc_resourcelist: - CL_LegacyParseResourceList( msg ); - break; - case svc_deltamovevars: - CL_ParseMovevars( msg ); - break; - case svc_resourcerequest: - CL_ParseResourceRequest( msg ); - break; - case svc_customization: - CL_ParseCustomization( msg ); - break; - case svc_crosshairangle: - CL_ParseCrosshairAngle( msg ); - break; - case svc_soundfade: - CL_ParseSoundFade( msg ); - break; - case svc_filetxferfailed: - CL_ParseFileTransferFailed( msg ); - break; - case svc_hltv: - CL_ParseHLTV( msg ); - break; - case svc_resourcelocation: - CL_ParseResLocation( msg ); - break; - case svc_querycvarvalue: - CL_ParseCvarValue( msg, false, PROTO_LEGACY ); - break; - case svc_querycvarvalue2: - CL_ParseCvarValue( msg, true, PROTO_LEGACY ); - break; - default: - CL_ParseUserMessage( msg, cmd, PROTO_LEGACY ); - cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart; - break; - } - } -} - -void CL_LegacyPrecache_f( void ) -{ - int spawncount, i; - model_t *mod; - - if( cls.legacymode != PROTO_LEGACY ) - return; - - spawncount = Q_atoi( Cmd_Argv( 1 )); - - Con_Printf( "Setting up renderer...\n" ); - - // load tempent sprites (glowshell, muzzleflashes etc) - CL_LoadClientSprites (); - - // invalidate all decal indexes - memset( cl.decal_index, 0, sizeof( cl.decal_index )); - cl.video_prepped = true; - cl.audio_prepped = true; - if( clgame.entities ) - clgame.entities->model = cl.worldmodel; - - // load skybox - R_SetupSky( clgame.movevars.skyName ); - - // tell rendering system we have a new set of models. - ref.dllFuncs.R_NewMap (); - - CL_SetupOverviewParams(); - - // release unused SpriteTextures - for( i = 1, mod = clgame.sprites; i < MAX_CLIENT_SPRITES; i++, mod++ ) - { - if( mod->needload == NL_UNREFERENCED && COM_CheckString( mod->name )) - Mod_FreeModel( mod ); - } - -// Mod_FreeUnused (); - - if( host_developer.value <= DEV_NONE ) - Con_ClearNotify(); // clear any lines of console text - - // done with all resources, issue prespawn command. - // Include server count in case server disconnects and changes level during d/l - MSG_BeginClientCmd( &cls.netchan.message, clc_stringcmd ); - MSG_WriteStringf( &cls.netchan.message, "begin %i", spawncount ); - cls.signon = SIGNONS - 1; -} diff --git a/engine/client/cl_parse_gs.c b/engine/client/cl_parse_gs.c index 4d9903ae..1fbf63e5 100644 --- a/engine/client/cl_parse_gs.c +++ b/engine/client/cl_parse_gs.c @@ -467,7 +467,7 @@ static void CL_ParseSoundPacketGS( sizebuf_t *msg ) chan = MSG_ReadUBitLong( msg, 3 ); entnum = MSG_ReadUBitLong( msg, MAX_GOLDSRC_ENTITY_BITS ); - if( FBitSet( flags, SND_LEGACY_LARGE_INDEX )) + if( FBitSet( flags, SND_GOLDSRC_LARGE_INDEX )) sound = MSG_ReadWord( msg ); else sound = MSG_ReadByte( msg ); MSG_ReadGSBitVec3Coord( msg, pos ); @@ -478,7 +478,7 @@ static void CL_ParseSoundPacketGS( sizebuf_t *msg ) MSG_EndBitWriting( msg ); - ClearBits( flags, SND_LEGACY_LARGE_INDEX ); + ClearBits( flags, SND_GOLDSRC_LARGE_INDEX ); if( FBitSet( flags, SND_SENTENCE )) { @@ -769,7 +769,7 @@ void CL_ParseGoldSrcServerMessage( sizebuf_t *msg ) CL_ParseExec( msg ); break; default: - CL_ParseUserMessage( msg, cmd, PROTO_LEGACY ); + CL_ParseUserMessage( msg, cmd, PROTO_GOLDSRC ); cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart; break; } diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 833cc262..b0624423 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -1899,9 +1899,7 @@ void CL_ParseTempEntity( sizebuf_t *msg, connprotocol_t proto ) if( proto != PROTO_GOLDSRC ) { - if( proto == PROTO_LEGACY ) - iSize = MSG_ReadByte( msg ); - else iSize = MSG_ReadWord( msg ); + iSize = MSG_ReadWord( msg ); // this will probably be fatal anyway if( iSize > sizeof( msg_data )) diff --git a/engine/client/client.h b/engine/client/client.h index 343cdc36..618f8061 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -956,12 +956,6 @@ void CL_ParseExec( sizebuf_t *msg ); void CL_BatchResourceRequest( qboolean initialize ); int CL_EstimateNeededResources( void ); -// -// cl_parse_48.c -// -void CL_ParseLegacyServerMessage( sizebuf_t *msg ); -void CL_LegacyPrecache_f( void ); - // // cl_parse_gs.c // diff --git a/engine/common/common.h b/engine/common/common.h index 964ea93b..6f1bcf3e 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -726,8 +726,8 @@ void HPAK_FlushHostQueue( void ); typedef enum connprotocol_e { PROTO_CURRENT = 0, // Xash3D 49 - PROTO_LEGACY, // Xash3D 48 - PROTO_QUAKE, // Quake 15 + // RIP Xash3D 48 + PROTO_QUAKE = 2, // Quake 15 PROTO_GOLDSRC, // GoldSrc 48 } connprotocol_t; diff --git a/engine/common/net_buffer.c b/engine/common/net_buffer.c index 672f33b1..10a634c1 100644 --- a/engine/common/net_buffer.c +++ b/engine/common/net_buffer.c @@ -197,7 +197,7 @@ static const char *const clc_strings[clc_lastmsg+1] = "clc_stringcmd", "clc_delta", "clc_resourcelist", - "clc_legacy_userinfo", + "clc_unused6", "clc_fileconsistency", "clc_voicedata", "clc_cvarvalue/clc_goldsrc_hltv", @@ -269,17 +269,6 @@ const char *const svc_strings[svc_lastmsg+1] = "svc_exec", }; -const char *const svc_legacy_strings[svc_lastmsg+1] = -{ - [svc_legacy_changing] = "svc_legacy_changing", - [svc_legacy_ambientsound] = "svc_legacy_ambientsound", - [svc_legacy_soundindex] = "svc_legacy_soundindex", - [svc_legacy_ambientsound] = "svc_legacy_ambientsound", - [svc_legacy_modelindex] = "svc_legacy_modelindex", - [svc_legacy_eventindex] = "svc_legacy_eventindex", - [svc_legacy_chokecount] = "svc_legacy_chokecount", -}; - const char *const svc_goldsrc_strings[svc_lastmsg+1] = { [svc_goldsrc_version] = "svc_goldsrc_version", diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index c26ad99e..80660547 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -153,102 +153,6 @@ void bz_internal_error( int errcode ) } #endif // XASH_DEDICATED -/* -================================= - -NETWORK PACKET SPLIT - -================================= -*/ - -/* -====================== -NetSplit_GetLong - -Collect fragmrnts with signature 0xFFFFFFFE to single packet -return true when got full packet -====================== -*/ -qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *length ) -{ - netsplit_packet_t *packet = (netsplit_packet_t*)data; - netsplit_chain_packet_t * p; - - //ASSERT( *length > NETSPLIT_HEADER_SIZE ); - if( *length <= NETSPLIT_HEADER_SIZE ) return false; - - LittleLongSW(packet->id); - LittleLongSW(packet->length); - LittleLongSW(packet->part); - - p = &ns->packets[packet->id & NETSPLIT_BACKUP_MASK]; - // Con_Reportf( S_NOTE "%s: packet from %s, id %d, index %d length %d\n", __func__, NET_AdrToString( *from ), (int)packet->id, (int)packet->index, (int)*length ); - - // no packets with this id received - if( packet->id != p->id ) - { - // warn if previous packet not received - if( p->received < p->count ) - { - UI_ShowConnectionWarning(); - Con_Reportf( S_WARN "%s: lost packet %d\n", __func__, p->id ); - } - - p->id = packet->id; - p->count = packet->count; - p->received = 0; - memset( p->recieved_v, 0, 32 ); - } - - // use bool vector to detect dup packets - if( p->recieved_v[packet->index >> 5 ] & ( 1 << ( packet->index & 31 ) ) ) - { - Con_Reportf( S_WARN "%s: dup packet from %s\n", __func__, NET_AdrToString( *from ) ); - return false; - } - - p->received++; - - // mark as received - p->recieved_v[packet->index >> 5] |= 1 << ( packet->index & 31 ); - - // prevent overflow - if( packet->part * packet->index > NET_MAX_PAYLOAD ) - { - Con_Reportf( S_WARN "%s: packet out fo bounds from %s (part %d index %d)\n", __func__, NET_AdrToString( *from ), packet->part, packet->index ); - return false; - } - - if( packet->length > NET_MAX_PAYLOAD ) - { - Con_Reportf( S_WARN "%s: packet out fo bounds from %s (length %d)\n", __func__, NET_AdrToString( *from ), packet->length ); - return false; - } - - memcpy( p->data + packet->part * packet->index, packet->data, *length - 18 ); - - // rewrite results of NET_GetPacket - if( p->received == packet->count ) - { - //ASSERT( packet->length % packet->part == (*length - NETSPLIT_HEADER_SIZE) % packet->part ); - size_t len = packet->length; - - ns->total_received += len; - - ns->total_received_uncompressed += len; - *length = len; - - // Con_Reportf( S_NOTE "%s: packet from %s, id %d received %d length %d\n", __func__, NET_AdrToString( *from ), (int)packet->id, (int)p->received, (int)packet->length ); - memcpy( data, p->data, len ); - return true; - } - else - *length = NETSPLIT_HEADER_SIZE + packet->part; - - - return false; -} - /* =============== Netchan_Init @@ -338,7 +242,6 @@ void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport, voi chan->qport = qport; chan->client = client; chan->pfnBlockSize = pfnBlockSize; - chan->split = FBitSet( flags, NETCHAN_USE_LEGACY_SPLIT ) ? true : false; chan->use_munge = FBitSet( flags, NETCHAN_USE_MUNGE ) ? true : false; chan->use_bz2 = FBitSet( flags, NETCHAN_USE_BZIP2 ) ? true : false; chan->use_lzss = FBitSet( flags, NETCHAN_USE_LZSS ) ? true : false; diff --git a/engine/common/net_encode.c b/engine/common/net_encode.c index d913aec5..0e2e6830 100644 --- a/engine/common/net_encode.c +++ b/engine/common/net_encode.c @@ -1794,7 +1794,7 @@ void MSG_ReadClientData( sizebuf_t *msg, const clientdata_t *from, clientdata_t pField = dt->pFields; Assert( pField != NULL ); - noChanges = !cls.legacymode && !MSG_ReadOneBit( msg ); + noChanges = !MSG_ReadOneBit( msg ); // process fields for( i = 0; i < dt->numFields; i++, pField++ ) @@ -2037,31 +2037,29 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, const entity_state_t *from, entity return false; } - if( !cls.legacymode ) - { - if( MSG_ReadOneBit( msg )) - baseline_offset = MSG_ReadSBitLong( msg, 7 ); + if( MSG_ReadOneBit( msg )) + baseline_offset = MSG_ReadSBitLong( msg, 7 ); - if( baseline_offset != 0 ) + if( baseline_offset != 0 ) + { + if( delta_type == DELTA_STATIC ) { - if( delta_type == DELTA_STATIC ) - { - int backup = Q_max( 0, clgame.numStatics - abs( baseline_offset )); - from = &clgame.static_entities[backup].baseline; - } - else if( baseline_offset > 0 ) - { - int backup = cls.next_client_entities - baseline_offset; - from = &cls.packet_entities[backup % cls.num_client_entities]; - } - else - { - baseline_offset = abs( baseline_offset + 1 ); - if( baseline_offset < cl.instanced_baseline_count ) - from = &cl.instanced_baseline[baseline_offset]; - } + int backup = Q_max( 0, clgame.numStatics - abs( baseline_offset )); + from = &clgame.static_entities[backup].baseline; + } + else if( baseline_offset > 0 ) + { + int backup = cls.next_client_entities - baseline_offset; + from = &cls.packet_entities[backup % cls.num_client_entities]; + } + else + { + baseline_offset = abs( baseline_offset + 1 ); + if( baseline_offset < cl.instanced_baseline_count ) + from = &cl.instanced_baseline[baseline_offset]; } } + // g-cont. probably is redundant *to = *from; @@ -2069,7 +2067,7 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, const entity_state_t *from, entity to->entityType = MSG_ReadUBitLong( msg, 2 ); to->number = number; - if( cls.legacymode ? ( to->entityType == ENTITY_BEAM ) : FBitSet( to->entityType, ENTITY_BEAM )) + if( FBitSet( to->entityType, ENTITY_BEAM )) { dt = Delta_FindStructByIndex( DT_CUSTOM_ENTITY_STATE_T ); } diff --git a/engine/common/net_ws.c b/engine/common/net_ws.c index f48fd5e6..241ff0c0 100644 --- a/engine/common/net_ws.c +++ b/engine/common/net_ws.c @@ -1363,18 +1363,13 @@ static qboolean NET_QueuePacket( netsrc_t sock, netadr_t *from, byte *data, size // Transfer data memcpy( data, buf, ret ); *length = ret; + #if !XASH_DEDICATED - { - connprotocol_t proto = CL_Protocol(); - - if( proto == PROTO_LEGACY ) - return NET_LagPacket( true, sock, from, length, data ); - - // check for split message - if( sock == NS_CLIENT && *(int *)data == NET_HEADER_SPLITPACKET ) - return NET_GetLong( data, ret, length, CL_GetSplitSize( ), proto ); - } + // check for split message + if( sock == NS_CLIENT && *(int *)data == NET_HEADER_SPLITPACKET ) + return NET_GetLong( data, ret, length, CL_GetSplitSize( ), CL_Protocol( )); #endif + // lag the packet, if needed return NET_LagPacket( true, sock, from, length, data ); } diff --git a/engine/common/netchan.h b/engine/common/netchan.h index 2f7cd75e..d388c842 100644 --- a/engine/common/netchan.h +++ b/engine/common/netchan.h @@ -78,10 +78,6 @@ GNU General Public License for more details. #define CMD_MASK (CMD_BACKUP - 1) #define NUM_PACKET_ENTITIES 256 // 170 Mb for multiplayer with 32 players #define MAX_CUSTOM_BASELINES 64 -#define NET_LEGACY_EXT_SPLIT (1U<<1) -#define NETSPLIT_BACKUP 8 -#define NETSPLIT_BACKUP_MASK (NETSPLIT_BACKUP - 1) -#define NETSPLIT_HEADER_SIZE 18 #if XASH_LOW_MEMORY == 2 #undef MULTIPLAYER_BACKUP @@ -105,42 +101,6 @@ GNU General Public License for more details. #define NET_MAX_FRAGMENT 32768 #endif -typedef struct netsplit_chain_packet_s -{ - // bool vector - uint32_t recieved_v[8]; - // serial number - uint32_t id; - byte data[NET_MAX_PAYLOAD]; - byte received; - byte count; -} netsplit_chain_packet_t; - -// raw packet format -typedef struct netsplit_packet_s -{ - uint32_t signature; // 0xFFFFFFFE - uint32_t length; - uint32_t part; - uint32_t id; - // max 256 parts - byte count; - byte index; - byte data[NET_MAX_PAYLOAD - NETSPLIT_HEADER_SIZE]; -} netsplit_packet_t; - - -typedef struct netsplit_s -{ - netsplit_chain_packet_t packets[NETSPLIT_BACKUP]; - uint64_t total_received; - uint64_t total_received_uncompressed; -} netsplit_t; - -// packet splitting -qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *length ); - - /* ============================================================== @@ -207,7 +167,6 @@ typedef enum fragsize_e typedef enum netchan_flags_e { - NETCHAN_USE_LEGACY_SPLIT = BIT( 0 ), NETCHAN_USE_MUNGE = BIT( 1 ), NETCHAN_USE_BZIP2 = BIT( 2 ), NETCHAN_GOLDSRC = BIT( 3 ), @@ -276,11 +235,7 @@ typedef struct netchan_s // added for net_speeds size_t total_sended; size_t total_received; - unsigned int maxpacket; - unsigned int splitid; - netsplit_t netsplit; - qboolean split; qboolean use_munge; qboolean use_bz2; qboolean use_lzss; diff --git a/engine/common/protocol.h b/engine/common/protocol.h index 17c2a379..b060ef41 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -279,45 +279,12 @@ GNU General Public License for more details. #define SU_WEAPON (1<<14) extern const char *const svc_strings[svc_lastmsg+1]; -extern const char *const svc_legacy_strings[svc_lastmsg+1]; extern const char *const svc_quake_strings[svc_lastmsg+1]; extern const char *const svc_goldsrc_strings[svc_lastmsg+1]; // FWGS extensions #define NET_EXT_SPLITSIZE (1U<<0) // set splitsize by cl_dlmax -// legacy protocol definitons -#define PROTOCOL_LEGACY_VERSION 48 -#define svc_legacy_modelindex 31 // [index][modelpath] -#define svc_legacy_soundindex 28 // [index][soundpath] -#define svc_legacy_eventindex 34 // [index][eventname] -#define svc_legacy_ambientsound 29 -#define svc_legacy_chokecount 42 // old client specified count, new just sends svc_choke -#define svc_legacy_event 27 // playback event queue -#define svc_legacy_changing 3 // changelevel by server request - -#define clc_legacy_userinfo 6 // [[userinfo string] - -#define SND_LEGACY_LARGE_INDEX (1<<2) // a send sound as short -#define MAX_LEGACY_ENTITY_BITS 12 -#define MAX_LEGACY_WEAPON_BITS 5 -#define MAX_LEGACY_MODEL_BITS 11 -#define MAX_LEGACY_TOTAL_CMDS 16 // 28 - 16 = 12 real legacy max backup -#define MAX_LEGACY_BACKUP_CMDS 12 - -#define MAX_LEGACY_EDICTS (1 << MAX_LEGACY_ENTITY_BITS) // 4096 edicts -#define MIN_LEGACY_EDICTS 30 - -// legacy engine features that can be implemented through currently supported features -#define ENGINE_LEGACY_FEATURES_MASK \ - ( ENGINE_WRITE_LARGE_COORD \ - | ENGINE_LOAD_DELUXEDATA \ - | ENGINE_LARGE_LIGHTMAPS \ - | ENGINE_COMPENSATE_QUAKE_BUG \ - | ENGINE_COMPUTE_STUDIO_LERP ) - -// Master Server protocol - // GoldSrc protocol definitions #define PROTOCOL_GOLDSRC_VERSION 48 @@ -336,6 +303,8 @@ extern const char *const svc_goldsrc_strings[svc_lastmsg+1]; #define clc_goldsrc_requestcvarvalue2 11 #define clc_goldsrc_lastmsg 11 +#define SND_GOLDSRC_LARGE_INDEX (1<<2) + #define MAX_GOLDSRC_BACKUP_CMDS 8 #define MAX_GOLDSRC_TOTAL_CMDS 16 #define MAX_GOLDSRC_EXTENDED_TOTAL_CMDS 62 @@ -346,9 +315,9 @@ extern const char *const svc_goldsrc_strings[svc_lastmsg+1]; #define MAX_GOLDSRC_EDICTS ( BIT( MAX_ENTITY_BITS ) + ( MAX_CLIENTS * 15 )) #define LAST_GOLDSRC_EDICT ( BIT( MAX_ENTITY_BITS ) - 1 ) +// Master Server protocol // from any to any (must be handled on both server and client) - #define A2A_PING "ping" // reply with A2A_ACK #define A2A_ACK "ack" // no-op #define A2A_INFO "info" // different format for client and server, see code