Revert "engine: client: implement connectionprogress partially"

This reverts commit cb417a3d51.

This commit breaks demo playback. Figure out why, then revert it back.
This commit is contained in:
Alibek Omarov 2019-10-06 07:43:57 +03:00
parent 39ff3b199a
commit d2a8cfe614
6 changed files with 13 additions and 65 deletions

View File

@ -193,8 +193,6 @@ void CL_CheckClientState( void )
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
Netchan_ReportFlow( &cls.netchan );
UI_SetActiveMenu( false );
Con_DPrintf( "client connected at %.2f sec\n", Sys_DoubleTime() - cls.timestart );
if(( cls.demoplayback || cls.disable_servercount != cl.servercount ) && cl.video_prepped )
SCR_EndLoadingPlaque(); // get rid of loading plaque
@ -1145,12 +1143,6 @@ void CL_CheckForResend( void )
if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER );
if( !cls.changelevel )
{
Cvar_SetValue( "scr_loading", scr_loading->value + 5.0f );
UI_ConnectionProgress_Connect( va( "#%d", cls.connect_retry ));
}
if( cls.connect_retry == CL_TEST_RETRIES_NORESPONCE )
{
// too many fails use default connection method
@ -1259,6 +1251,10 @@ void CL_Connect_f( void )
Con_Printf( "server %s\n", server );
CL_Disconnect();
// TESTTEST: a see console during connection
UI_SetActiveMenu( false );
Key_SetKeyDest( key_console );
cls.state = ca_connecting;
cls.legacymode = legacyconnect;
Q_strncpy( cls.servername, server, sizeof( cls.servername ));
@ -1509,8 +1505,6 @@ void CL_Disconnect( void )
IN_LockInputDevices( false ); // unlock input devices
UI_ConnectionProgress_Disconnect();
cls.state = ca_disconnected;
memset( &cls.serveradr, 0, sizeof( cls.serveradr ) );
cls.set_lastdemo = false;
@ -1922,6 +1916,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
}
CL_Reconnect( true );
UI_SetActiveMenu( cl.background );
}
else if( !Q_strcmp( c, "info" ))
{
@ -2002,7 +1997,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
else
{
if( cls.connect_retry >= CL_TEST_RETRIES )
{
{
// too many fails use default connection method
Con_Printf( "hi-speed connection is failed, use default method\n" );
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
@ -2415,7 +2410,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 )
{
if( host.downloadcount > 0 )
@ -2615,8 +2609,6 @@ qboolean CL_PrecacheResources( void )
{
resource_t *pRes;
UI_ConnectionProgress_Precache();
// NOTE: world need to be loaded as first model
for( pRes = cl.resourcesonhand.pNext; pRes && pRes != &cl.resourcesonhand; pRes = pRes->pNext )
{

View File

@ -904,7 +904,7 @@ void CL_ParseServerData( sizebuf_t *msg )
if( Con_FixedFont( ))
{
// separate the printfs so the server message can have a color
// seperate the printfs so the server message can have a color
Con_Print( "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n" );
Con_Print( va( "%c%s\n\n", 2, clgame.maptitle ));
}
@ -920,9 +920,6 @@ void CL_ParseServerData( sizebuf_t *msg )
if( r_decals->value > mp_decals.value )
Cvar_SetValue( "r_decals", mp_decals.value );
if( !cls.demoplayback )
UI_ConnectionProgress_ParseServerInfo( "server" );
}
else Cvar_Reset( "r_decals" );
@ -946,9 +943,7 @@ void CL_ParseServerData( sizebuf_t *msg )
}
if( !cls.changedemo )
{
// UI_SetActiveMenu( cl.background );
}
UI_SetActiveMenu( cl.background );
else if( !cls.demoplayback )
Key_SetKeyDest( key_menu );
@ -2136,7 +2131,6 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
else cls.state = ca_connecting;
cl.background = old_background;
cls.connect_time = MAX_HEARTBEAT;
UI_ConnectionProgress_ChangeLevel();
}
break;
case svc_setview:
@ -2429,9 +2423,6 @@ void CL_ParseLegacyServerData( sizebuf_t *msg )
if( r_decals->value > mp_decals.value )
Cvar_SetValue( "r_decals", mp_decals.value );
if( !cls.demoplayback )
UI_ConnectionProgress_ParseServerInfo( "server" );
}
else Cvar_Reset( "r_decals" );
@ -2455,9 +2446,7 @@ void CL_ParseLegacyServerData( sizebuf_t *msg )
}
if( !cls.changedemo )
{
// UI_SetActiveMenu( cl.background );
}
UI_SetActiveMenu( cl.background );
else if( !cls.demoplayback )
Key_SetKeyDest( key_menu );
@ -2893,8 +2882,6 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
else cls.state = ca_connecting;
cl.background = old_background;
cls.connect_time = MAX_HEARTBEAT;
UI_ConnectionProgress_ChangeLevel();
}
break;
case svc_setview:
@ -3130,8 +3117,6 @@ void CL_LegacyPrecache_f( void )
spawncount = Q_atoi( Cmd_Argv( 1 ));
UI_ConnectionProgress_Precache();
Con_Printf( "Setting up renderer...\n" );
// load tempent sprites (glowshell, muzzleflashes etc)

View File

@ -248,9 +248,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
S_StopBackgroundTrack ();
if( !cls.changedemo )
{
// UI_SetActiveMenu( cl.background );
}
UI_SetActiveMenu( cl.background );
else if( !cls.demoplayback )
Key_SetKeyDest( key_menu );

View File

@ -350,6 +350,7 @@ void SCR_BeginLoadingPlaque( qboolean is_background )
if( CL_IsInMenu( ) && !cls.changedemo && !is_background )
{
UI_SetActiveMenu( false );
if( cls.state == ca_disconnected )
SCR_UpdateScreen();
}

View File

@ -1937,9 +1937,8 @@ void Con_DrawDebug( void )
if( scr_download->value != -1.0f )
{
UI_ConnectionProgress_Download( host.downloadfile, "server", NULL, 1, host.downloadcount, "(direct)" );
Q_snprintf( dlstring, sizeof( dlstring ), "Downloading [%d remaining]: ^2%s^7 %5.1f%% time %.f secs",
host.downloadcount, host.downloadfile, scr_download->value, Sys_DoubleTime() - timeStart );
host.downloadcount, host.downloadfile, scr_download->value, Sys_DoubleTime() - timeStart );
x = refState.width - 500;
y = con.curFont->charHeight * 1.05f;
Con_DrawString( x, y, dlstring, g_color_table[7] );

View File

@ -1812,8 +1812,6 @@ static struct http_static_s
// file and server lists
httpfile_t *first_file, *last_file;
httpserver_t *first_server, *last_server;
int fileCount;
} http;
@ -1852,8 +1850,6 @@ static void HTTP_FreeFile( httpfile_t *file, qboolean error )
{
char incname[256];
http.fileCount--;
// Allways close file and socket
if( file->file )
FS_Close( file->file );
@ -2017,11 +2013,6 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile )
return false;
}
#ifndef XASH_DEDICATED
UI_ConnectionProgress_Download( curfile->path, curfile->server->host, curfile->server->path,
curfile->id, http.fileCount, va( "(file size is %d)", curfile->size ) );
#endif // XASH_DEDICATED
curfile->state = HTTP_RESPONSE_RECEIVED; // got response, let's start download
begin += 4;
@ -2063,16 +2054,9 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile )
// as after it will run in same frame
if( curfile->checktime > 5 )
{
float speed = (float)curfile->lastchecksize / ( 5.0 * 1024 );
curfile->checktime = 0;
Con_Reportf( "download speed %.2f KB/s\n", speed );
Con_Reportf( "download speed %f KB/s\n", (float)curfile->lastchecksize / ( 5.0 * 1024 ) );
curfile->lastchecksize = 0;
#ifndef XASH_DEDICATED
UI_ConnectionProgress_Download( curfile->path, curfile->server->host, curfile->server->path,
curfile->id, http.fileCount, va( "(file size is %d, speed is %.2f KB/s)", curfile->size, speed ) );
#endif // XASH_DEDICATED
}
}
}
@ -2120,9 +2104,6 @@ void HTTP_Run( void )
}
Con_Reportf( "HTTP: Starting download %s from %s\n", curfile->path, curfile->server->host );
#ifndef XASH_DEDICATED
UI_ConnectionProgress_Download( curfile->path, curfile->server->host, curfile->server->path, curfile->id, http.fileCount, "(starting)");
#endif // XASH_DEDICATED
Q_snprintf( name, sizeof( name ), "downloaded/%s.incomplete", curfile->path );
curfile->file = FS_Open( name, "wb", true );
@ -2218,10 +2199,6 @@ void HTTP_Run( void )
{
qboolean wait = false;
#ifndef XASH_DEDICATED
UI_ConnectionProgress_Download( curfile->path, curfile->server->host, curfile->server->path, curfile->id, http.fileCount, "(sending request)");
#endif // XASH_DEDICATED
while( curfile->bytes_sent < curfile->query_length )
{
res = send( curfile->socket, curfile->buf + curfile->bytes_sent, curfile->query_length - curfile->bytes_sent, 0 );
@ -2311,8 +2288,6 @@ void HTTP_AddDownload( const char *path, int size, qboolean process )
Con_Reportf( "File %s queued to download\n", path );
http.fileCount++;
httpfile->size = size;
httpfile->downloaded = 0;
httpfile->socket = -1;
@ -2456,7 +2431,6 @@ Clear all queue
static void HTTP_Clear_f( void )
{
http.last_file = NULL;
http.fileCount = 0;
while( http.first_file )
{
@ -2557,7 +2531,6 @@ void HTTP_Init( void )
http.last_server = NULL;
http.first_file = http.last_file = NULL;
http.fileCount = 0;
Cmd_AddCommand("http_download", &HTTP_Download_f, "add file to download queue");
Cmd_AddCommand("http_skip", &HTTP_Skip_f, "skip current download server");