Beispiel #1
0
/*
=================
UI_ServerInfoMenu
=================
*/
void UI_ServerInfoMenu( void )
{
	const char		*s;
	char			key[MAX_INFO_KEY];
	char			value[MAX_INFO_VALUE];

	// zero set all our globals
	memset( &s_serverinfo, 0 ,sizeof(serverinfo_t) );

	ServerInfo_Cache();

	s_serverinfo.menu.draw       = ServerInfo_MenuDraw;
	s_serverinfo.menu.key        = ServerInfo_MenuKey;
	s_serverinfo.menu.wrapAround = qtrue;
	s_serverinfo.menu.fullscreen = qtrue;

	s_serverinfo.banner.generic.type  = MTYPE_BTEXT;
	s_serverinfo.banner.generic.x	  = 320;
	s_serverinfo.banner.generic.y	  = 16;
	s_serverinfo.banner.string		  = "SERVER INFO";
	s_serverinfo.banner.color	      = color_white;
	s_serverinfo.banner.style	      = UI_CENTER;

	s_serverinfo.framel.generic.type  = MTYPE_BITMAP;
	s_serverinfo.framel.generic.name  = SERVERINFO_FRAMEL;
	s_serverinfo.framel.generic.flags = QMF_INACTIVE;
	s_serverinfo.framel.generic.x	  = 0;  
	s_serverinfo.framel.generic.y	  = 78;
	s_serverinfo.framel.width  	      = 256;
	s_serverinfo.framel.height  	  = 329;

	s_serverinfo.framer.generic.type  = MTYPE_BITMAP;
	s_serverinfo.framer.generic.name  = SERVERINFO_FRAMER;
	s_serverinfo.framer.generic.flags = QMF_INACTIVE;
	s_serverinfo.framer.generic.x	  = 376;
	s_serverinfo.framer.generic.y	  = 76;
	s_serverinfo.framer.width  	      = 256;
	s_serverinfo.framer.height  	  = 334;

	s_serverinfo.add.generic.type	  = MTYPE_PTEXT;
	s_serverinfo.add.generic.flags    = QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_serverinfo.add.generic.callback = ServerInfo_Event;
	s_serverinfo.add.generic.id	      = ID_ADD;
	s_serverinfo.add.generic.x		  = 320;
	s_serverinfo.add.generic.y		  = 371;
	s_serverinfo.add.string  		  = "ADD TO FAVORITES";
	s_serverinfo.add.style  		  = UI_CENTER|UI_SMALLFONT;
	s_serverinfo.add.color			  =	color_red;
	if( trap_Cvar_VariableValue( "sv_running" ) ) {
		s_serverinfo.add.generic.flags |= QMF_GRAYED;
	}

	s_serverinfo.back.generic.type	   = MTYPE_BITMAP;
	s_serverinfo.back.generic.name     = SERVERINFO_BACK0;
	s_serverinfo.back.generic.flags    = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	s_serverinfo.back.generic.callback = ServerInfo_Event;
	s_serverinfo.back.generic.id	   = ID_BACK;
	s_serverinfo.back.generic.x		   = 0;
	s_serverinfo.back.generic.y		   = 480-64;
	s_serverinfo.back.width  		   = 128;
	s_serverinfo.back.height  		   = 64;
	s_serverinfo.back.focuspic         = SERVERINFO_BACK1;

	trap_GetConfigString( CS_SERVERINFO, s_serverinfo.info, MAX_INFO_STRING );

	s_serverinfo.numlines = 0;
	s = s_serverinfo.info;
	while ( s ) {
		Info_NextPair( &s, key, value );
		if ( !key[0] ) {
			break;
		}
		s_serverinfo.numlines++;
	}

	if (s_serverinfo.numlines > 16)
		s_serverinfo.numlines = 16;

	Menu_AddItem( &s_serverinfo.menu, (void*) &s_serverinfo.banner );
	Menu_AddItem( &s_serverinfo.menu, (void*) &s_serverinfo.framel );
	Menu_AddItem( &s_serverinfo.menu, (void*) &s_serverinfo.framer );
	Menu_AddItem( &s_serverinfo.menu, (void*) &s_serverinfo.add );
	Menu_AddItem( &s_serverinfo.menu, (void*) &s_serverinfo.back );

	UI_PushMenu( &s_serverinfo.menu );
}
/*
=================
UI_ServerInfoMenu
=================
*/
void UI_ServerInfoMenu( void )
{
	const char		*s;
	char			key[MAX_INFO_KEY];
	char			value[MAX_INFO_VALUE];

	// zero set all our globals
	memset( &s_serverinfo, 0 ,sizeof(serverinfo_t) );

	ServerInfo_Cache();

	s_serverinfo.menu.draw       = ServerInfo_MenuDraw;
	s_serverinfo.menu.key        = ServerInfo_MenuKey;
	s_serverinfo.arrowup.generic.type		= MTYPE_BITMAP1024S;
	s_serverinfo.arrowup.x					= 630;
	s_serverinfo.arrowup.y					= 226;
	s_serverinfo.arrowup.w					= 29;
	s_serverinfo.arrowup.h					= 74;
	s_serverinfo.arrowup.shader				= trap_R_RegisterShaderNoMip(ARROWUP0);
	s_serverinfo.arrowup.mouseovershader	= trap_R_RegisterShaderNoMip(ARROWUP1);
	s_serverinfo.arrowup.generic.callback	= ServerInfo_Event;
	s_serverinfo.arrowup.generic.id			= ID_SCROLL_UP;
	Menu_AddItem( &s_serverinfo.menu, (void*) &s_serverinfo.arrowup );

	s_serverinfo.arrowdown.generic.type		= MTYPE_BITMAP1024S;
	s_serverinfo.arrowdown.x				= 630;
	s_serverinfo.arrowdown.y				= 436-74;
	s_serverinfo.arrowdown.w				= 29;//38
	s_serverinfo.arrowdown.h				= 74;//98
	s_serverinfo.arrowdown.shader			= trap_R_RegisterShaderNoMip(ARROWDOWN0);
	s_serverinfo.arrowdown.mouseovershader	= trap_R_RegisterShaderNoMip(ARROWDOWN1);
	s_serverinfo.arrowdown.generic.callback	= ServerInfo_Event;
	s_serverinfo.arrowdown.generic.id		= ID_SCROLL_DOWN;
	Menu_AddItem( &s_serverinfo.menu, (void*) &s_serverinfo.arrowdown );

	s_serverinfo.add.generic.type		= MTYPE_TEXTS;
	s_serverinfo.add.fontHeight			= 18.0f;
	s_serverinfo.add.generic.flags		= QMF_CENTER_JUSTIFY;//|QMF_PULSEIFFOCUS;
	s_serverinfo.add.generic.callback	= ServerInfo_Event;
	s_serverinfo.add.generic.id			= ID_ADD;
	s_serverinfo.add.generic.x			= 320;
	s_serverinfo.add.generic.y			= 290;
	s_serverinfo.add.string				= "ADD TO FAVORiTES";
	s_serverinfo.add.style				= UI_CENTER|UI_SMALLFONT;
	s_serverinfo.add.color				= colorDkBlue;
	s_serverinfo.add.focuscolor			= colorBlue;
	if( trap_Cvar_VariableValue( "sv_running" ) ) {
		s_serverinfo.add.generic.flags |= QMF_GRAYED;
	}

	s_serverinfo.back.generic.type		= MTYPE_TEXTS;
	s_serverinfo.back.fontHeight		= 16.0f;
//	s_serverinfo.back.generic.flags		= QMF_PULSEIFFOCUS;
	s_serverinfo.back.generic.callback	= ServerInfo_Event;
	s_serverinfo.back.generic.id		= ID_BACK;
	s_serverinfo.back.generic.x			= 245;
	s_serverinfo.back.generic.y			= 315;
	s_serverinfo.back.string			= "BACK";
	s_serverinfo.back.style				= UI_SMALLFONT;
	s_serverinfo.back.color				= color_black;
	s_serverinfo.back.focuscolor		= color_orange;

	trap_GetConfigString( CS_SERVERINFO, s_serverinfo.info, MAX_INFO_STRING );

	s_serverinfo.numlines = 0;
	s = s_serverinfo.info;
	while ( s ) {
		Info_NextPair( &s, key, value );
		if ( !key[0] ) {
			break;
		}
		s_serverinfo.numlines++;
	}


	Menu_AddItem( &s_serverinfo.menu, (void*) &s_serverinfo.add );
	Menu_AddItem( &s_serverinfo.menu, (void*) &s_serverinfo.back );

	UI_PushMenu( &s_serverinfo.menu );
}