summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/ui/joinserver.menu73
-rw-r--r--assets/ui/menudef.h1
-rw-r--r--src/cgame/cg_draw.c2
-rw-r--r--src/ui/ui_gameinfo.c6
-rw-r--r--src/ui/ui_local.h1
-rw-r--r--src/ui/ui_main.c46
-rw-r--r--src/ui/ui_shared.c16
-rw-r--r--src/ui/ui_shared.h1
8 files changed, 68 insertions, 78 deletions
diff --git a/assets/ui/joinserver.menu b/assets/ui/joinserver.menu
index c96cc2be..ccadd87e 100644
--- a/assets/ui/joinserver.menu
+++ b/assets/ui/joinserver.menu
@@ -43,9 +43,6 @@
#define LIST_Y ((2*BORDER)+TOP_H)
#define LIST_TOFF 5
#define HEADFOOT_H 25
-#define SERVER_H 16
-#define NUM_FEATURED 4
-#define FEATURED_H (SERVER_H*NUM_FEATURED+2)
menuDef
{
@@ -195,6 +192,24 @@
}
}
+ // LEGEND //
+
+ itemDef
+ {
+ name legend
+ type ITEM_TYPE_TEXT
+ text "[official] = Offical Server\n[featured] = Featured Server"
+ style WINDOW_STYLE_EMPTY
+ textstyle ITEM_TEXTSTYLE_NORMAL
+ textscale .25
+ wrapped
+ rect (TOP_X+(2*TOPBUTT_W)) (TOP_Y+TOPBUTT_H) (TOPBUTT_W) (TOPBUTT_H)
+ textalign ALIGN_LEFT
+ textvalign VALIGN_CENTER
+ forecolor 1 1 1 1
+ visible MENU_TRUE
+ decoration
+ }
// MAP PREVIEW //
@@ -216,7 +231,7 @@
{
name server
group grpTabs
- text "Featured Servers"
+ text "Server Name"
type ITEM_TYPE_BUTTON
textscale .33
style WINDOW_STYLE_EMPTY
@@ -384,57 +399,13 @@
itemDef
{
- name featuredlist
- rect LIST_X (LIST_Y+HEADFOOT_H) LIST_W FEATURED_H
- type ITEM_TYPE_LISTBOX
- style WINDOW_STYLE_EMPTY
- elementwidth 120
- elementheight SERVER_H
- textscale .25
- elementtype LISTBOX_TEXT
- feeder FEEDER_FEATURED
- border WINDOW_BORDER_FULL
- bordercolor 0.5 0.5 0.5 1
- forecolor 1 1 1 1
- backcolor 0.2 0.2 0.2 1
- outlinecolor 0.1 0.1 0.1 0.5
- visible MENU_TRUE
- columns 4
- LIST_TOFF ((SERVER_C*LIST_W)-(3*LIST_TOFF)) ALIGN_LEFT
- (LIST_TOFF+((SERVER_C)*LIST_W)) ((MAP_C*LIST_W)-(3*LIST_TOFF)) ALIGN_LEFT
- (LIST_TOFF+((SERVER_C+MAP_C)*LIST_W)) ((PLAYERS_C*LIST_W)-(3*LIST_TOFF)) ALIGN_LEFT
- (LIST_TOFF+((SERVER_C+MAP_C+PLAYERS_C)*LIST_W)) ((PING_C*LIST_W)-(3*LIST_TOFF)) ALIGN_LEFT
-
- doubleClick { uiScript JoinServer }
- }
-
- itemDef
- {
- name featuredseparator
- rect LIST_X (LIST_Y+FEATURED_H+HEADFOOT_H) LIST_W HEADFOOT_H
- type ITEM_TYPE_TEXT
- text "Community Servers"
- textalign ALIGN_LEFT
- textvalign VALIGN_CENTER
- textalignx LIST_TOFF
- visible MENU_TRUE
- textScale 0.33
- border WINDOW_BORDER_FULL
- bordercolor 0.5 0.5 0.5 1
- forecolor 1 1 1 1
- backcolor 0.2 0.2 0.2 1
- outlinecolor 0.1 0.1 0.1 0.5
- }
-
- itemDef
- {
name serverlist
- rect LIST_X (LIST_Y+FEATURED_H+(HEADFOOT_H*2)) LIST_W (LIST_H-(FEATURED_H+(HEADFOOT_H*3)))
+ rect LIST_X (LIST_Y+HEADFOOT_H) LIST_W (LIST_H-(2*HEADFOOT_H))
type ITEM_TYPE_LISTBOX
style WINDOW_STYLE_EMPTY
elementwidth 120
- elementheight SERVER_H
- textscale .25
+ elementheight 20
+ textscale .33
elementtype LISTBOX_TEXT
feeder FEEDER_SERVERS
border WINDOW_BORDER_FULL
diff --git a/assets/ui/menudef.h b/assets/ui/menudef.h
index 0ec235ab..f87fc34e 100644
--- a/assets/ui/menudef.h
+++ b/assets/ui/menudef.h
@@ -87,7 +87,6 @@ enum
enum
{
FEEDER_SERVERS, // servers
- FEEDER_FEATURED, // featured servers
FEEDER_MAPS, // all maps available, in graphic format
FEEDER_ALIENTEAM_LIST, // alien team members
FEEDER_HUMANTEAM_LIST, // human team members
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 2a0a2ba5..18427b8a 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -1149,7 +1149,7 @@ static void CG_DrawHostname( rectDef_t *rect, float text_x, float text_y,
info = CG_ConfigString( CS_SERVERINFO );
- Q_strncpyz( buffer, Info_ValueForKey( info, "sv_hostname" ), 1024 );
+ UI_EscapeEmoticons( buffer, Info_ValueForKey( info, "sv_hostname" ), sizeof( buffer ) );
Q_CleanStr( buffer );
UI_DrawTextBlock( rect, text_x, text_y, color, scale, textalign, textvalign, textStyle, buffer );
diff --git a/src/ui/ui_gameinfo.c b/src/ui/ui_gameinfo.c
index b39be790..6c4e4681 100644
--- a/src/ui/ui_gameinfo.c
+++ b/src/ui/ui_gameinfo.c
@@ -346,6 +346,7 @@ char *UI_GetBotNameByNumber( int num )
void UI_ServerInfo( void )
{
char info[ MAX_INFO_VALUE ];
+ char hostname[MAX_HOSTNAME_LENGTH];
info[0] = '\0';
@@ -357,8 +358,9 @@ void UI_ServerInfo( void )
Info_ValueForKey( info, "timelimit" ) );
trap_Cvar_Set( "ui_serverinfo_sd",
Info_ValueForKey( info, "g_suddenDeathTime" ) );
- trap_Cvar_Set( "ui_serverinfo_hostname",
- Info_ValueForKey( info, "sv_hostname" ) );
+ UI_EscapeEmoticons( hostname, Info_ValueForKey( info, "sv_hostname" ),
+ sizeof( hostname ) );
+ trap_Cvar_Set( "ui_serverinfo_hostname", hostname );
trap_Cvar_Set( "ui_serverinfo_maxclients",
Info_ValueForKey( info, "sv_maxclients" ) );
trap_Cvar_Set( "ui_serverinfo_version",
diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h
index 86649d62..46210d02 100644
--- a/src/ui/ui_local.h
+++ b/src/ui/ui_local.h
@@ -105,7 +105,6 @@ typedef struct serverStatus_s
int currentServer;
int displayServers[MAX_DISPLAY_SERVERS];
int numDisplayServers;
- int numFeaturedServers;
int numPlayersOnServers;
int nextDisplayRefresh;
int nextSortTime;
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index ab96fa3e..2937cbc2 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -283,9 +283,6 @@ static void UI_InsertServerIntoDisplayList( int num, int position )
uiInfo.serverStatus.numDisplayServers++;
- if( Info_ValueForKey( info, "label" )[0] )
- uiInfo.serverStatus.numFeaturedServers++;
-
for( i = uiInfo.serverStatus.numDisplayServers; i > position; i-- )
uiInfo.serverStatus.displayServers[i] = uiInfo.serverStatus.displayServers[i-1];
@@ -309,8 +306,6 @@ static void UI_RemoveServerFromDisplayList( int num )
uiInfo.serverStatus.numDisplayServers--;
trap_LAN_GetServerInfo( ui_netSource.integer, num, info, MAX_STRING_CHARS );
- if( Info_ValueForKey( info, "label" )[0] )
- uiInfo.serverStatus.numFeaturedServers--;
for( j = i; j < uiInfo.serverStatus.numDisplayServers; j++ )
uiInfo.serverStatus.displayServers[j] = uiInfo.serverStatus.displayServers[j+1];
@@ -848,7 +843,6 @@ static void UI_BuildServerDisplayList( qboolean force )
numinvisible = 0;
// clear number of displayed servers
uiInfo.serverStatus.numDisplayServers = 0;
- uiInfo.serverStatus.numFeaturedServers = 0;
uiInfo.serverStatus.numPlayersOnServers = 0;
// set list box index to zero
Menu_SetFeederSelection( NULL, FEEDER_SERVERS, 0, NULL );
@@ -863,7 +857,6 @@ static void UI_BuildServerDisplayList( qboolean force )
{
// still waiting on a response from the master
uiInfo.serverStatus.numDisplayServers = 0;
- uiInfo.serverStatus.numFeaturedServers = 0;
uiInfo.serverStatus.numPlayersOnServers = 0;
uiInfo.serverStatus.nextDisplayRefresh = uiInfo.uiDC.realTime + 500;
return;
@@ -1056,7 +1049,6 @@ static void UI_StartServerRefresh( qboolean full )
uiInfo.serverStatus.nextDisplayRefresh = uiInfo.uiDC.realTime + 1000;
// clear number of displayed servers
uiInfo.serverStatus.numDisplayServers = 0;
- uiInfo.serverStatus.numFeaturedServers = 0;
uiInfo.serverStatus.numPlayersOnServers = 0;
// mark all servers as visible so we store ping updates for them
trap_LAN_MarkServerVisible( ui_netSource.integer, -1, qtrue );
@@ -3354,10 +3346,7 @@ static int UI_FeederCount( float feederID )
else if( feederID == FEEDER_MAPS )
return uiInfo.mapCount;
else if( feederID == FEEDER_SERVERS )
- return uiInfo.serverStatus.numDisplayServers -
- uiInfo.serverStatus.numFeaturedServers;
- else if( feederID == FEEDER_FEATURED )
- return uiInfo.serverStatus.numFeaturedServers;
+ return uiInfo.serverStatus.numDisplayServers;
else if( feederID == FEEDER_SERVERSTATUS )
return uiInfo.serverStatusInfo.numLines;
else if( feederID == FEEDER_NEWS )
@@ -3438,6 +3427,7 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
{
static char info[MAX_STRING_CHARS];
static char hostname[1024];
+ static char cleaned[1024];
static char clientBuff[32];
static char resolution[MAX_STRING_CHARS];
static int lastColumn = -1;
@@ -3451,15 +3441,12 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
int actual;
return UI_SelectedMap( index, &actual );
}
- else if( feederID == FEEDER_SERVERS || feederID == FEEDER_FEATURED )
+ else if( feederID == FEEDER_SERVERS )
{
if( index >= 0 && index < UI_FeederCount( feederID ) )
{
int ping;
- if( feederID == FEEDER_SERVERS )
- index += UI_FeederCount( FEEDER_FEATURED );
-
if( lastColumn != column || lastTime > uiInfo.uiDC.realTime + 5000 )
{
trap_LAN_GetServerInfo( ui_netSource.integer, uiInfo.serverStatus.displayServers[index],
@@ -3476,6 +3463,8 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
// UI_UpdatePendingPings();
}
+ UI_EscapeEmoticons( cleaned, Info_ValueForKey( info, "hostname" ), sizeof( cleaned ) );
+
switch( column )
{
case SORT_HOST:
@@ -3486,15 +3475,30 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
if( ui_netSource.integer == AS_LOCAL )
{
Com_sprintf( hostname, sizeof( hostname ), "%s [%s]",
- Info_ValueForKey( info, "hostname" ),
+ cleaned,
netnames[atoi( Info_ValueForKey( info, "nettype" ) )] );
return hostname;
}
else
{
char *text;
-
- Com_sprintf( hostname, sizeof( hostname ), "%s", Info_ValueForKey( info, "hostname" ) );
+ char *label;
+
+ label = Info_ValueForKey( info, "label" );
+ if( label[0] )
+ {
+ // First char of the label response is a sorting tag. Skip it.
+ label+= 1;
+
+ Com_sprintf( hostname, sizeof( hostname ), "%s %s",
+ label,
+ cleaned );
+ }
+ else
+ {
+ Com_sprintf( hostname, sizeof( hostname ), "%s",
+ cleaned );
+ }
// Strip leading whitespace
text = hostname;
@@ -3707,12 +3711,10 @@ static void UI_FeederSelection( float feederID, int index )
trap_CIN_PlayCinematic( va( "%s.roq", uiInfo.mapList[ui_selectedMap.integer].mapLoadName ),
0, 0, 0, 0, ( CIN_loop | CIN_silent ) );
}
- else if( feederID == FEEDER_SERVERS || feederID == FEEDER_FEATURED )
+ else if( feederID == FEEDER_SERVERS )
{
const char *mapName = NULL;
- if( feederID == FEEDER_SERVERS )
- index += UI_FeederCount( FEEDER_FEATURED );
uiInfo.serverStatus.currentServer = index;
trap_LAN_GetServerInfo( ui_netSource.integer, uiInfo.serverStatus.displayServers[index],
info, MAX_STRING_CHARS );
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 25bbff2a..bcb694ce 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -1833,6 +1833,22 @@ void Script_playLooped( itemDef_t *item, char **args )
}
}
+void UI_EscapeEmoticons( char *dest, const char *src, int destsize )
+{
+ int len;
+ qboolean escaped;
+ for( ; *src && destsize > 1; src++, destsize-- )
+ {
+ if ( UI_Text_Emoticon( src, &escaped, &len, NULL, NULL ) && !escaped )
+ {
+ *dest++ = '[';
+ destsize--;
+ }
+ *dest++ = *src;
+ }
+ *dest++ = '\0';
+}
+
qboolean UI_Text_Emoticon( const char *s, qboolean *escaped,
int *length, qhandle_t *h, int *width )
{
diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h
index dec93587..e2e30508 100644
--- a/src/ui/ui_shared.h
+++ b/src/ui/ui_shared.h
@@ -521,6 +521,7 @@ float UI_Text_Height( const char *text, float scale, int limit );
float UI_Text_EmWidth( float scale );
float UI_Text_EmHeight( float scale );
qboolean UI_Text_Emoticon( const char *s, qboolean *escaped, int *length, qhandle_t *h, int *width );
+void UI_EscapeEmoticons( char *dest, const char *src, int destsize );
int trap_Parse_AddGlobalDefine( char *define );
int trap_Parse_LoadSource( const char *filename );