engine: implement connection warning dialog showing up, update menu

This commit is contained in:
Alibek Omarov 2019-07-12 22:41:57 +03:00
parent 9e30fc253f
commit a85a856215
6 changed files with 36 additions and 3 deletions

View File

@ -2088,7 +2088,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
if( cls.internetservers_pending )
{
Cbuf_AddText( "menu_resetping\n" ); // TODO: New Menu API
UI_ResetPing();
cls.internetservers_pending = false;
}
}
@ -2713,6 +2713,29 @@ void CL_Escape_f( void )
else UI_SetActiveMenu( true );
}
/*
=================
CL_WarnLostSplitPacket
=================
*/
void CL_WarnLostSplitPacket( void )
{
if( cls.state != ca_connected )
return;
if( Host_IsLocalClient() )
return;
if( ++cl.lostpackets == 8 )
{
CL_Disconnect();
UI_ShowConnectionWarning();
MsgDev( D_WARN, "Too many lost packets! Showing Network options menu\n" );
}
}
/*
=================
CL_InitLocal

View File

@ -265,6 +265,8 @@ typedef struct
short decal_index[MAX_DECALS];
model_t *worldmodel; // pointer to world
int lostpackets; // count lost packets and show dialog in menu
} client_t;
/*
@ -490,6 +492,7 @@ typedef struct
{
void *hInstance; // pointer to client.dll
UI_FUNCTIONS dllFuncs; // dll exported funcs
UI_EXTENDED_FUNCTIONS dllFuncs2; // fwgs extension
byte *mempool; // client edicts pool
cl_entity_t playermodel; // uiPlayerSetup drawing model
@ -1071,6 +1074,7 @@ qboolean UI_CreditsActive( void );
void UI_CharEvent( int key );
qboolean UI_MouseInRect( void );
qboolean UI_IsVisible( void );
void UI_ResetPing( void );
void UI_AddTouchButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags );
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a );
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc );

View File

@ -851,6 +851,7 @@ qboolean CL_IsInConsole( void );
qboolean CL_IsThirdPerson( void );
qboolean CL_IsIntermission( void );
qboolean CL_Initialized( void );
void CL_WarnLostSplitPacket( void );
char *CL_Userinfo( void );
void CL_LegacyUpdateInfo( void );
void CL_CharEvent( int key );

View File

@ -327,4 +327,9 @@ void CL_ClearStaticEntities( void )
}
void CL_WarnLostSplitPacket( void )
{
}
#endif // XASH_DEDICATED

View File

@ -140,7 +140,7 @@ qboolean NetSplit_GetLong( netsplit_t *ns, netadr_t *from, byte *data, size_t *l
// warn if previous packet not received
if( p->received < p->count )
{
//CL_WarnLostSplitPacket();
CL_WarnLostSplitPacket();
Con_Reportf( S_WARN "NetSplit_GetLong: lost packet %d\n", p->id );
}

2
mainui

@ -1 +1 @@
Subproject commit 155a1d80ddffd6696c965853e2f97167d9b4da59
Subproject commit f43379a48cb0b9d1fa076a0fbb6eee8b73b47775