Browse Source

engine: implement connection warning dialog showing up, update menu

pull/2/head
Alibek Omarov 5 years ago
parent
commit
a85a856215
  1. 25
      engine/client/cl_main.c
  2. 4
      engine/client/client.h
  3. 1
      engine/common/common.h
  4. 5
      engine/common/dedicated.c
  5. 2
      engine/common/net_chan.c
  6. 2
      mainui

25
engine/client/cl_main.c

@ -2088,7 +2088,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
if( cls.internetservers_pending ) if( cls.internetservers_pending )
{ {
Cbuf_AddText( "menu_resetping\n" ); // TODO: New Menu API UI_ResetPing();
cls.internetservers_pending = false; cls.internetservers_pending = false;
} }
} }
@ -2713,6 +2713,29 @@ void CL_Escape_f( void )
else UI_SetActiveMenu( true ); 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 CL_InitLocal

4
engine/client/client.h

@ -265,6 +265,8 @@ typedef struct
short decal_index[MAX_DECALS]; short decal_index[MAX_DECALS];
model_t *worldmodel; // pointer to world model_t *worldmodel; // pointer to world
int lostpackets; // count lost packets and show dialog in menu
} client_t; } client_t;
/* /*
@ -490,6 +492,7 @@ typedef struct
{ {
void *hInstance; // pointer to client.dll void *hInstance; // pointer to client.dll
UI_FUNCTIONS dllFuncs; // dll exported funcs UI_FUNCTIONS dllFuncs; // dll exported funcs
UI_EXTENDED_FUNCTIONS dllFuncs2; // fwgs extension
byte *mempool; // client edicts pool byte *mempool; // client edicts pool
cl_entity_t playermodel; // uiPlayerSetup drawing model cl_entity_t playermodel; // uiPlayerSetup drawing model
@ -1071,6 +1074,7 @@ qboolean UI_CreditsActive( void );
void UI_CharEvent( int key ); void UI_CharEvent( int key );
qboolean UI_MouseInRect( void ); qboolean UI_MouseInRect( void );
qboolean UI_IsVisible( 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 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_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 ); void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc );

1
engine/common/common.h

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

5
engine/common/dedicated.c

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

2
engine/common/net_chan.c

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

2
mainui

@ -1 +1 @@
Subproject commit 155a1d80ddffd6696c965853e2f97167d9b4da59 Subproject commit f43379a48cb0b9d1fa076a0fbb6eee8b73b47775
Loading…
Cancel
Save