Example #1
0
void CG_MouseEvent( int x, int y )
{
	int n;

	if ( ( cg.predictedPlayerState.pm_type == PM_NORMAL ||
	       cg.predictedPlayerState.pm_type == PM_SPECTATOR ) &&
	     cg.showScores == qfalse )
	{
		trap_Key_SetCatcher( 0 );
		return;
	}

	cgs.cursorX += x;

	if ( cgs.cursorX < 0 )
	{
		cgs.cursorX = 0;
	}
	else if ( cgs.cursorX > 640 )
	{
		cgs.cursorX = 640;
	}

	cgs.cursorY += y;

	if ( cgs.cursorY < 0 )
	{
		cgs.cursorY = 0;
	}
	else if ( cgs.cursorY > 480 )
	{
		cgs.cursorY = 480;
	}
}
Example #2
0
static void UI_MessageMode_f( void )
{
  char *arg = UI_Argv( 0 );

  trap_Cvar_Set( "ui_sayBuffer", "" );

  switch( arg[ 11 ] )
  {
    default:
    case '\0':
      // Global
      uiInfo.chatTeam             = qfalse;
      break;

    case '2':
      // Team
      uiInfo.chatTeam             = qtrue;
      break;
  }

  trap_Key_SetCatcher( KEYCATCH_UI );
  Menus_CloseByName( "say" );
  Menus_CloseByName( "say_team" );

  if( uiInfo.chatTeam )
    Menus_ActivateByName( "say_team" );
  else
    Menus_ActivateByName( "say" );
}
Example #3
0
/*
===============
UI_SaveMenu_f
===============
*/
static void UI_SaveMenu_f( void ) 
{
	ui.PrecacheScreenshot();

	trap_Key_SetCatcher( KEYCATCH_UI );
	Menus_ActivateByName("ingamesaveMenu");
}
Example #4
0
static void UI_Menu_f( void )
{
    if( Menu_Count( ) > 0 )
    {
      trap_Key_SetCatcher( KEYCATCH_UI );
      Menus_ActivateByName( UI_Argv( 1 ) );
    }
}
Example #5
0
void UI_ForceMenuOff(void) {
  uis.menusp = 0;
  uis.activemenu = NULL;

  trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_UI);
  trap_Key_ClearStates();
  trap_Cvar_Set("cl_paused", "0");
}
Example #6
0
/*
===============
UI_SaveMenu_f
===============
*/
static void UI_SaveMenu_f( void )
{
#ifdef JK2_MODE
	ui.PrecacheScreenshot();
#endif

	trap_Key_SetCatcher( KEYCATCH_UI );
	Menus_ActivateByName("ingamesaveMenu");
}
Example #7
0
void CG_MouseEvent(int x, int y) {
	switch ((int)cgs.eventHandling) {
	case CGAME_EVENT_SPEAKEREDITOR:
	case CGAME_EVENT_GAMEVIEW:
	case CGAME_EVENT_CAMPAIGNBREIFING:
	case CGAME_EVENT_FIRETEAMMSG:
		cgs.cursorX += x;
		if (cgs.cursorX < 0) {
			cgs.cursorX = 0;
		} else if (cgs.cursorX > 640) {
			cgs.cursorX = 640;
		}

		cgs.cursorY += y;
		if (cgs.cursorY < 0) {
			cgs.cursorY = 0;
		} else if (cgs.cursorY > 480) {
			cgs.cursorY = 480;
		}

		if ((int)cgs.eventHandling == CGAME_EVENT_SPEAKEREDITOR) {
			CG_SpeakerEditorMouseMove_Handling(x, y);
		}

		break;
	case CGAME_EVENT_DEMO:
		cgs.cursorX += x;
		if (cgs.cursorX < 0) {
			cgs.cursorX = 0;
		} else if (cgs.cursorX > 640) {
			cgs.cursorX = 640;
		}

		cgs.cursorY += y;
		if (cgs.cursorY < 0) {
			cgs.cursorY = 0;
		} else if (cgs.cursorY > 480) {
			cgs.cursorY = 480;
		}

		if (x != 0 || y != 0) {
			cgs.cursorUpdate = cg.time + 5000;
		}
		break;


	default:
		// default handling
		if ((cg.predictedPlayerState.pm_type == PM_NORMAL ||
		     cg.predictedPlayerState.pm_type == PM_SPECTATOR) &&
		    cg.showScores == qfalse) {
			trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_CGAME);
			return;
		}
		break;
	}
}
Example #8
0
/*
=================
UI_SPPostgameMenu_f
=================
*/
void UI_SPPostgameMenu_f( void ) {
	int			playerGameRank;
//	int			oldFrags, newFrags;
	const char	*arena;
	char		map[MAX_QPATH];
	char		info[MAX_INFO_STRING];

	Mouse_Show();

	memset( &postgameMenuInfo, 0, sizeof(postgameMenuInfo) );

	trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
	postgameMenuInfo.serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );

	postgameMenuInfo.menu.nobackground = qtrue;

	trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
	Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
	arena = UI_GetArenaInfoByMap( map );
	if ( !arena ) {
		return;
	}
	Q_strncpyz( arenainfo, arena, sizeof(arenainfo) );

	postgameMenuInfo.level = atoi( Info_ValueForKey( arenainfo, "num" ) );

	playerGameRank = 8;		// in case they ended game as a spectator
	playerGameRank = atoi( UI_Argv(1));

	UI_SetBestScore( postgameMenuInfo.level, playerGameRank+1 );

	postgameMenuInfo.starttime = uis.realtime;
	postgameMenuInfo.scoreboardtime = uis.realtime;

	trap_Key_SetCatcher( KEYCATCH_UI );
	uis.menusp = 0;

	UI_SPPostgameMenu_Init();
	UI_PushMenu( &postgameMenuInfo.menu );

	if (playerGameRank == 0) 
	{
		postgameMenuInfo.won = 1;
		Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_next );
	}
	else {
		Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_menu );
	}

//	trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" );	//?? always win?  should this be deleted and playing cg_scoreboard now?

	postgameMenuInfo.lastTier = UI_GetNumSPTiers();
	if ( UI_GetSpecialArenaInfo( "final" ) ) {
		postgameMenuInfo.lastTier++;
	}
}
Example #9
0
static void UI_CloseMenus_f( void )
{
    if( Menu_Count( ) > 0 )
    {
      trap_Key_SetCatcher( trap_Key_GetCatcher( ) & ~KEYCATCH_UI );
      trap_Key_ClearStates( );
      trap_Cvar_Set( "cl_paused", "0" );
      Menus_CloseAll( );
    }
}
Example #10
0
/*
=================
UI_PushMenu
=================
*/
void UI_PushMenu( menuframework_s *menu )
{
	int				i;
	menucommon_s*	item;

	// avoid stacking menus invoked by hotkeys
	for (i=0 ; i<uis.menusp ; i++)
	{
		if (uis.stack[i] == menu)
		{
			uis.menusp = i;
			break;
		}
	}

	if (i == uis.menusp)
	{
		if (uis.menusp >= MAX_MENUDEPTH)
			trap_Error("UI_PushMenu: menu stack overflow");

		uis.stack[uis.menusp++] = menu;
	}

	uis.activemenu = menu;

	// default cursor position
	menu->cursor      = 0;
	menu->cursor_prev = 0;

	// pushmenu pushmenu has more priority than popmenu
	soundTime = 0;
	UI_StartSound( menu_in_sound );
	soundTime = uis.realtime + 150;

	trap_Key_SetCatcher( KEYCATCH_UI );

	// force first available item to have focus
	for (i=0; i<menu->nitems; i++)
	{
		item = (menucommon_s *)menu->items[i];
		if (!(item->flags & (QMF_GRAYED|QMF_MOUSEONLY|QMF_INACTIVE)))
		{
			menu->cursor_prev = -1;
			Menu_SetCursor( menu, i );
			break;
		}
	}

	uis.firstdraw = qtrue;
}
Example #11
0
void CG_KeyEvent( int key, int chr, int flags )
{
	if ( !( flags & KEYEVSTATE_DOWN ) )
	{
		return;
	}

	if ( cg.predictedPlayerState.pm_type == PM_NORMAL ||
	     ( cg.predictedPlayerState.pm_type == PM_SPECTATOR &&
	       cg.showScores == qfalse ) )
	{
		trap_Key_SetCatcher( 0 );
		return;
	}
}
Example #12
0
/*
================
Con_ToggleConsole_f
================
*/
void Con_ToggleConsole_f (void) {
	uiClientState_t	cls;

	trap_GetClientState( &cls );

	// Can't toggle the console when it's the only thing available
	if ( cls.connState == CA_DISCONNECTED && trap_Key_GetCatcher( ) == KEYCATCH_CONSOLE ) {
		return;
	}

	if ( con_autoclear.integer ) {
		MField_Clear( &g_consoleField );
	}

	g_consoleField.widthInChars = g_console_field_width;

	trap_Key_SetCatcher( trap_Key_GetCatcher( ) ^ KEYCATCH_CONSOLE );
}
Example #13
0
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand( int realTime ) {
	char	*cmd;

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime = realTime;

	cmd = UI_Argv( 0 );

	// ensure minimum menu data is available
	//Menu_Cache();

	if ( Q_stricmp (cmd, "ui_test") == 0 ) {
		UI_ShowPostGame(qtrue);
	}

	if ( Q_stricmp (cmd, "ui_report") == 0 ) {
		UI_Report();
		return qtrue;
	}
	
	if ( Q_stricmp (cmd, "ui_load") == 0 ) {
		UI_Load();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_opensiegemenu" ) == 0 ) 
	{
		if ( trap_Cvar_VariableValue ( "g_gametype" ) == GT_SIEGE )
		{
			Menus_CloseAll();
			if (Menus_ActivateByName(UI_Argv(1)))
			{
				trap_Key_SetCatcher( KEYCATCH_UI );
			}
		}
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_openmenu" ) == 0 ) 
	{
		//if ( trap_Cvar_VariableValue ( "developer" ) )
		{
			Menus_CloseAll();
			if (Menus_ActivateByName(UI_Argv(1)))
			{
				trap_Key_SetCatcher( KEYCATCH_UI );
			}
			return qtrue;
		}
	}

	/*
	if ( Q_stricmp (cmd, "remapShader") == 0 ) {
		if (trap_Argc() == 4) {
			char shader1[MAX_QPATH];
			char shader2[MAX_QPATH];
			Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
			Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
			trap_R_RemapShader(shader1, shader2, UI_Argv(3));
			return qtrue;
		}
	}
	*/

	if ( Q_stricmp (cmd, "postgame") == 0 ) {
		UI_CalcPostGameStats();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_cache") == 0 ) {
		UI_Cache_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) {
		//UI_TeamOrdersMenu_f();
		return qtrue;
	}
	if ( Q_stricmp (cmd, "pause") == 0 ) {
		return qtrue;
	}
	return qfalse;
}
Example #14
0
/*
===============
UI_MainMenu

The main menu only comes up when not in a game,
so make sure that the attract loop server is down
and that local cinematics are killed
===============
*/
void UI_MainMenu( void )
{
	int		y;
	qboolean teamArena = qfalse;
	int		style = UI_CENTER | UI_DROPSHADOW;

	trap_Cvar_Set( "sv_killserver", "1" );
	trap_Cvar_SetValue( "handicap", 100 ); //Reset handicap during server change, it must be ser per game

	memset( &s_main, 0 ,sizeof(mainmenu_t) );
	memset( &s_errorMessage, 0 ,sizeof(errorMessage_t) );

	// com_errorMessage would need that too
	MainMenu_Cache();

	trap_Cvar_VariableStringBuffer( "com_errorMessage", s_errorMessage.errorMessage, sizeof(s_errorMessage.errorMessage) );
	if (strlen(s_errorMessage.errorMessage)) {
		s_errorMessage.menu.draw = Main_MenuDraw;
		s_errorMessage.menu.key = ErrorMessage_Key;
		s_errorMessage.menu.fullscreen = qtrue;
		s_errorMessage.menu.wrapAround = qtrue;
		s_errorMessage.menu.showlogo = qtrue;

		trap_Key_SetCatcher( KEYCATCH_UI );
		uis.menusp = 0;
		UI_PushMenu ( &s_errorMessage.menu );

		return;
	}

	s_main.menu.draw = Main_MenuDraw;
	s_main.menu.fullscreen = qtrue;
	s_main.menu.wrapAround = qtrue;
	s_main.menu.showlogo = qtrue;

	y = 134;
	s_main.singleplayer.generic.type		= MTYPE_PTEXT;
	s_main.singleplayer.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.singleplayer.generic.x			= 320;
	s_main.singleplayer.generic.y			= y;
	s_main.singleplayer.generic.id			= ID_SINGLEPLAYER;
	s_main.singleplayer.generic.callback	= Main_MenuEvent;
	s_main.singleplayer.string				= "SINGLE PLAYER";
	s_main.singleplayer.color				= color_red;
	s_main.singleplayer.style				= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.multiplayer.generic.type			= MTYPE_PTEXT;
	s_main.multiplayer.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.multiplayer.generic.x			= 320;
	s_main.multiplayer.generic.y			= y;
	s_main.multiplayer.generic.id			= ID_MULTIPLAYER;
	s_main.multiplayer.generic.callback		= Main_MenuEvent;
	s_main.multiplayer.string				= "MULTIPLAYER";
	s_main.multiplayer.color				= color_red;
	s_main.multiplayer.style				= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.setup.generic.type				= MTYPE_PTEXT;
	s_main.setup.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.setup.generic.x					= 320;
	s_main.setup.generic.y					= y;
	s_main.setup.generic.id					= ID_SETUP;
	s_main.setup.generic.callback			= Main_MenuEvent;
	s_main.setup.string						= "SETUP";
	s_main.setup.color						= color_red;
	s_main.setup.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.demos.generic.type				= MTYPE_PTEXT;
	s_main.demos.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.demos.generic.x					= 320;
	s_main.demos.generic.y					= y;
	s_main.demos.generic.id					= ID_DEMOS;
	s_main.demos.generic.callback			= Main_MenuEvent;
	s_main.demos.string						= "DEMOS";
	s_main.demos.color						= color_red;
	s_main.demos.style						= style;

	/*y += MAIN_MENU_VERTICAL_SPACING;
	s_main.cinematics.generic.type			= MTYPE_PTEXT;
	s_main.cinematics.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.cinematics.generic.x				= 320;
	s_main.cinematics.generic.y				= y;
	s_main.cinematics.generic.id			= ID_CINEMATICS;
	s_main.cinematics.generic.callback		= Main_MenuEvent;
	s_main.cinematics.string				= "CINEMATICS";
	s_main.cinematics.color					= color_red;
	s_main.cinematics.style					= style;*/

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.challenges.generic.type			= MTYPE_PTEXT;
	s_main.challenges.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.challenges.generic.x				= 320;
	s_main.challenges.generic.y				= y;
	s_main.challenges.generic.id			= ID_CHALLENGES;
	s_main.challenges.generic.callback		= Main_MenuEvent;
	s_main.challenges.string				= "STATISTICS";
	s_main.challenges.color					= color_red;
	s_main.challenges.style					= style;

	if (UI_TeamArenaExists()) {
		teamArena = qtrue;
		y += MAIN_MENU_VERTICAL_SPACING;
		s_main.teamArena.generic.type			= MTYPE_PTEXT;
		s_main.teamArena.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
		s_main.teamArena.generic.x				= 320;
		s_main.teamArena.generic.y				= y;
		s_main.teamArena.generic.id				= ID_TEAMARENA;
		s_main.teamArena.generic.callback		= Main_MenuEvent;
		s_main.teamArena.string					= "MISSION PACK";
		s_main.teamArena.color					= color_red;
		s_main.teamArena.style					= style;
	}

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.mods.generic.type			= MTYPE_PTEXT;
	s_main.mods.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.mods.generic.x				= 320;
	s_main.mods.generic.y				= y;
	s_main.mods.generic.id				= ID_MODS;
	s_main.mods.generic.callback		= Main_MenuEvent;
	s_main.mods.string					= "MODS";
	s_main.mods.color					= color_red;
	s_main.mods.style					= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.exit.generic.type				= MTYPE_PTEXT;
	s_main.exit.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.exit.generic.x					= 320;
	s_main.exit.generic.y					= y;
	s_main.exit.generic.id					= ID_EXIT;
	s_main.exit.generic.callback			= Main_MenuEvent;
	s_main.exit.string						= "EXIT";
	s_main.exit.color						= color_red;
	s_main.exit.style						= style;

	Menu_AddItem( &s_main.menu,	&s_main.singleplayer );
	Menu_AddItem( &s_main.menu,	&s_main.multiplayer );
	Menu_AddItem( &s_main.menu,	&s_main.setup );
	Menu_AddItem( &s_main.menu,	&s_main.demos );
	//Menu_AddItem( &s_main.menu,	&s_main.cinematics );
	Menu_AddItem( &s_main.menu,	&s_main.challenges );
	if (teamArena) {
		Menu_AddItem( &s_main.menu,	&s_main.teamArena );
	}
	Menu_AddItem( &s_main.menu,	&s_main.mods );
	Menu_AddItem( &s_main.menu,	&s_main.exit );

	trap_Key_SetCatcher( KEYCATCH_UI );
	uis.menusp = 0;
	UI_PushMenu ( &s_main.menu );

}
Example #15
0
/*
===============
UI_LoadMenu_f
===============
*/
static void UI_LoadMenu_f( void ) 
{
	trap_Key_SetCatcher( KEYCATCH_UI );
	Menus_ActivateByName("ingameloadMenu");
}
Example #16
0
/*
===============
UI_MainMenu

The main menu only comes up when not in a game,
so make sure that the attract loop server is down
and that local cinematics are killed
===============
*/
void UI_MainMenu( void ) {
	int		y;
	int		style = UI_CENTER | UI_DROPSHADOW;

	trap_Cvar_Set( "sv_killserver", "1" );

/* blud, commenting out the cdkey check since iourt doesn't need one
	if( !uis.demoversion && !ui_cdkeychecked.integer ) {
		char	key[17];

		trap_GetCDKey( key, sizeof(key) );
		if( trap_VerifyCDKey( key, NULL ) == qfalse ) {
			UI_CDKeyMenu();
			return;
		}
	}
*/

	memset( &s_main, 0 ,sizeof(mainmenu_t) );
	memset( &s_errorMessage, 0 ,sizeof(errorMessage_t) );

	// com_errorMessage would need that too
	MainMenu_Cache();

	trap_Cvar_VariableStringBuffer( "com_errorMessage", s_errorMessage.errorMessage, sizeof(s_errorMessage.errorMessage) );
	if (strlen(s_errorMessage.errorMessage))
	{
		s_errorMessage.menu.draw = Main_MenuDraw;
		s_errorMessage.menu.key = ErrorMessage_Key;
		s_errorMessage.menu.fullscreen = qtrue;
		s_errorMessage.menu.wrapAround = qtrue;
		s_errorMessage.menu.showlogo = qtrue;

		trap_Key_SetCatcher( KEYCATCH_UI );
		uis.menusp = 0;
		UI_PushMenu ( &s_errorMessage.menu );

		return;
	}

	s_main.menu.draw = Main_MenuDraw;
	s_main.menu.fullscreen = qtrue;
	s_main.menu.wrapAround = qtrue;
	s_main.menu.showlogo = qtrue;

	y = 134;
	s_main.singleplayer.generic.type		= MTYPE_PTEXT;
	s_main.singleplayer.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.singleplayer.generic.x			= 320;
	s_main.singleplayer.generic.y			= y;
	s_main.singleplayer.generic.id			= ID_SINGLEPLAYER;
	s_main.singleplayer.generic.callback	= Main_MenuEvent;
	s_main.singleplayer.string				= "SINGLE PLAYER";
	s_main.singleplayer.color				= color_white;
	s_main.singleplayer.style				= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.multiplayer.generic.type			= MTYPE_PTEXT;
	s_main.multiplayer.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.multiplayer.generic.x			= 320;
	s_main.multiplayer.generic.y			= y;
	s_main.multiplayer.generic.id			= ID_MULTIPLAYER;
	s_main.multiplayer.generic.callback		= Main_MenuEvent;
	s_main.multiplayer.string				= "MULTIPLAYER";
	s_main.multiplayer.color				= color_white;
	s_main.multiplayer.style				= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.setup.generic.type				= MTYPE_PTEXT;
	s_main.setup.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.setup.generic.x					= 320;
	s_main.setup.generic.y					= y;
	s_main.setup.generic.id					= ID_SETUP;
	s_main.setup.generic.callback			= Main_MenuEvent;
	s_main.setup.string						= "SETUP";
	s_main.setup.color						= color_white;
	s_main.setup.style						= style;

// blud commenting out these menu items below!
/*blud
	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.demos.generic.type				= MTYPE_PTEXT;
	s_main.demos.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.demos.generic.x					= 320;
	s_main.demos.generic.y					= y;
	s_main.demos.generic.id					= ID_DEMOS;
	s_main.demos.generic.callback			= Main_MenuEvent;
	s_main.demos.string						= "DEMOS";
	s_main.demos.color						= color_red;
	s_main.demos.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.cinematics.generic.type			= MTYPE_PTEXT;
	s_main.cinematics.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.cinematics.generic.x				= 320;
	s_main.cinematics.generic.y				= y;
	s_main.cinematics.generic.id			= ID_CINEMATICS;
	s_main.cinematics.generic.callback		= Main_MenuEvent;
	s_main.cinematics.string				= "CINEMATICS";
	s_main.cinematics.color					= color_red;
	s_main.cinematics.style					= style;

	if (UI_TeamArenaExists()) {
		teamArena = qtrue;
		y += MAIN_MENU_VERTICAL_SPACING;
		s_main.teamArena.generic.type			= MTYPE_PTEXT;
		s_main.teamArena.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
		s_main.teamArena.generic.x				= 320;
		s_main.teamArena.generic.y				= y;
		s_main.teamArena.generic.id				= ID_TEAMARENA;
		s_main.teamArena.generic.callback		= Main_MenuEvent;
		s_main.teamArena.string					= "TEAM ARENA";
		s_main.teamArena.color					= color_red;
		s_main.teamArena.style					= style;
	}

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.mods.generic.type			= MTYPE_PTEXT;
	s_main.mods.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.mods.generic.x				= 320;
	s_main.mods.generic.y				= y;
	s_main.mods.generic.id				= ID_MODS;
	s_main.mods.generic.callback		= Main_MenuEvent;
	s_main.mods.string					= "MODS";
	s_main.mods.color					= color_red;
	s_main.mods.style					= style;
// blud commenting out these menu items above!
*/

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.exit.generic.type				= MTYPE_PTEXT;
	s_main.exit.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.exit.generic.x					= 320;
	s_main.exit.generic.y					= y;
	s_main.exit.generic.id					= ID_EXIT;
	s_main.exit.generic.callback			= Main_MenuEvent;
	s_main.exit.string						= "EXIT";
	s_main.exit.color						= color_white;
	s_main.exit.style						= style;

	Menu_AddItem( &s_main.menu,	&s_main.singleplayer );
	Menu_AddItem( &s_main.menu,	&s_main.multiplayer );
	Menu_AddItem( &s_main.menu,	&s_main.setup );
	/* also commented out by blud
	Menu_AddItem( &s_main.menu,	&s_main.demos );
	Menu_AddItem( &s_main.menu,	&s_main.cinematics );
	if (teamArena) {
		Menu_AddItem( &s_main.menu,	&s_main.teamArena );
	}
	Menu_AddItem( &s_main.menu,	&s_main.mods );
	*/
	Menu_AddItem( &s_main.menu,	&s_main.exit );

	trap_Key_SetCatcher( KEYCATCH_UI );
	uis.menusp = 0;
	UI_PushMenu ( &s_main.menu );

}
Example #17
0
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand( int realTime ) {
	char	*cmd;

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime = realTime;

	cmd = UI_Argv( 0 );

	// ensure minimum menu data is available
	//Menu_Cache();

// JKG - Only allow these commands if we're using a debug compile
// We don't want players f****n around with these
#ifdef _DEBUG

	if ( Q_stricmp (cmd, "ui_report") == 0 ) {
		UI_Report();
		return qtrue;
	}
	/*if ( Q_stricmp (cmd, "ui_testmaster") == 0) {
		JKG_GLUI_Task_Test(testMasterFinalFunc);
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_testterms") == 0) {
		JKG_GLUI_Task_GetTermsOfUse(termsMasterFinalFunc);
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_testregister") == 0 ) {
		char username[32];
		char password[32];
		char email[64];

		trap_Argv(1, username, 32);
		trap_Argv(2, password, 32);
		trap_Argv(3, email, 32);

		JKG_GLUI_Task_RegisterUser(username, password, email, registerFinalFunc);
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_testlogin") == 0 ) {
		char username[32];
		char password[32];

		trap_Argv(1, username, 32);
		trap_Argv(2, password, 32);

		JKG_GLUI_Task_Login(username, password, loginFinalFunc);
		return qtrue;
	}*/

	
	

	if ( Q_stricmp (cmd, "ui_report") == 0 ) {
		UI_Report();
		return qtrue;
	}
	
	if ( Q_stricmp (cmd, "ui_load") == 0 ) {
		UI_Load();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_openmenu" ) == 0 ) 
	{
		//if ( trap_Cvar_VariableValue ( "developer" ) )
		{
			Menus_CloseAll();
			if (Menus_ActivateByName(UI_Argv(1)))
			{
				trap_Key_SetCatcher( KEYCATCH_UI );
			}
			return qtrue;
		}
	}

	if ( Q_stricmp (cmd, "ui_cache") == 0 ) {
		UI_Cache_f();
		return qtrue;
	}

	if ( Q_stricmp (cmd, "ui_teamOrders") == 0 ) {
		//UI_TeamOrdersMenu_f();
		return qtrue;
	}


#endif // _DEBUG

	return qfalse;
}
/*
=================
UI_SPPostgameMenu_f
=================
*/
void UI_SPPostgameMenu_f( void ) {
    int			playerGameRank;
    int			playerClientNum;
    int			n;
    int			oldFrags, newFrags;
    const char	*arena;
    int			awardValues[6];
    char		map[MAX_QPATH];
    char		info[MAX_INFO_STRING];

    memset( &postgameMenuInfo, 0, sizeof(postgameMenuInfo) );

    trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
    postgameMenuInfo.serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );

    trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
    Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
    arena = UI_GetArenaInfoByMap( map );
    if ( !arena ) {
        return;
    }
    Q_strncpyz( arenainfo, arena, sizeof(arenainfo) );

    postgameMenuInfo.level = atoi( Info_ValueForKey( arenainfo, "num" ) );

    postgameMenuInfo.numClients = atoi( UI_Argv( 1 ) );
    playerClientNum = atoi( UI_Argv( 2 ) );
    playerGameRank = 8;		// in case they ended game as a spectator

    if( postgameMenuInfo.numClients > MAX_SCOREBOARD_CLIENTS ) {
        postgameMenuInfo.numClients = MAX_SCOREBOARD_CLIENTS;
    }

    for( n = 0; n < postgameMenuInfo.numClients; n++ ) {
        postgameMenuInfo.clientNums[n] = atoi( UI_Argv( 8 + n * 3 + 1 ) );
        postgameMenuInfo.ranks[n] = atoi( UI_Argv( 8 + n * 3 + 2 ) );
        postgameMenuInfo.scores[n] = atoi( UI_Argv( 8 + n * 3 + 3 ) );

        if( postgameMenuInfo.clientNums[n] == playerClientNum ) {
            playerGameRank = (postgameMenuInfo.ranks[n] & ~RANK_TIED_FLAG) + 1;
        }
    }

    UI_SetBestScore( postgameMenuInfo.level, playerGameRank );

    // process award stats and prepare presentation data
    awardValues[AWARD_ACCURACY] = atoi( UI_Argv( 3 ) );
    awardValues[AWARD_IMPRESSIVE] = atoi( UI_Argv( 4 ) );
    awardValues[AWARD_EXCELLENT] = atoi( UI_Argv( 5 ) );
    awardValues[AWARD_GAUNTLET] = atoi( UI_Argv( 6 ) );
    awardValues[AWARD_FRAGS] = atoi( UI_Argv( 7 ) );
    awardValues[AWARD_PERFECT] = atoi( UI_Argv( 8 ) );

    postgameMenuInfo.numAwards = 0;

    if( awardValues[AWARD_ACCURACY] >= 50 ) {
        UI_LogAwardData( AWARD_ACCURACY, 1 );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_ACCURACY;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_ACCURACY];
        postgameMenuInfo.numAwards++;
    }

    if( awardValues[AWARD_IMPRESSIVE] ) {
        UI_LogAwardData( AWARD_IMPRESSIVE, awardValues[AWARD_IMPRESSIVE] );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_IMPRESSIVE;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_IMPRESSIVE];
        postgameMenuInfo.numAwards++;
    }

    if( awardValues[AWARD_EXCELLENT] ) {
        UI_LogAwardData( AWARD_EXCELLENT, awardValues[AWARD_EXCELLENT] );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_EXCELLENT;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_EXCELLENT];
        postgameMenuInfo.numAwards++;
    }

    if( awardValues[AWARD_GAUNTLET] ) {
        UI_LogAwardData( AWARD_GAUNTLET, awardValues[AWARD_GAUNTLET] );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_GAUNTLET;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = awardValues[AWARD_GAUNTLET];
        postgameMenuInfo.numAwards++;
    }

    oldFrags = UI_GetAwardLevel( AWARD_FRAGS ) / 100;
    UI_LogAwardData( AWARD_FRAGS, awardValues[AWARD_FRAGS] );
    newFrags = UI_GetAwardLevel( AWARD_FRAGS ) / 100;
    if( newFrags > oldFrags ) {
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_FRAGS;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = newFrags * 100;
        postgameMenuInfo.numAwards++;
    }

    if( awardValues[AWARD_PERFECT] ) {
        UI_LogAwardData( AWARD_PERFECT, 1 );
        postgameMenuInfo.awardsEarned[postgameMenuInfo.numAwards] = AWARD_PERFECT;
        postgameMenuInfo.awardsLevels[postgameMenuInfo.numAwards] = 1;
        postgameMenuInfo.numAwards++;
    }

    if ( playerGameRank == 1 ) {
        postgameMenuInfo.won = UI_TierCompleted( postgameMenuInfo.level );
    }
    else {
        postgameMenuInfo.won = -1;
    }

    postgameMenuInfo.starttime = uis.realtime;
    postgameMenuInfo.scoreboardtime = uis.realtime;

    trap_Key_SetCatcher( KEYCATCH_UI );
    uis.menusp = 0;

    UI_SPPostgameMenu_Init();
    UI_PushMenu( &postgameMenuInfo.menu );

    if ( playerGameRank == 1 ) {
        Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_next );
    }
    else {
        Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_again );
    }

    Prepname( 0 );
    Prepname( 1 );
    Prepname( 2 );

    if ( playerGameRank != 1 ) {
        postgameMenuInfo.winnerSound = trap_S_RegisterSound( va( "sound/player/announce/%s_wins.wav", postgameMenuInfo.placeNames[0] ), qfalse );
        trap_Cmd_ExecuteText( EXEC_APPEND, "music music/loss\n" );
    }
    else {
        postgameMenuInfo.winnerSound = trap_S_RegisterSound( "sound/player/announce/youwin.wav", qfalse );
        trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" );
    }

    postgameMenuInfo.phase = 1;

    postgameMenuInfo.lastTier = UI_GetNumSPTiers();
    if ( UI_GetSpecialArenaInfo( "final" ) ) {
        postgameMenuInfo.lastTier++;
    }
}
Example #19
0
/**
 * @brief CG_MouseEvent
 * @param[in] x
 * @param[in] y
 */
void CG_MouseEvent(int x, int y)
{
	switch (cgs.eventHandling)
	{
	case CGAME_EVENT_DEMO:
	case CGAME_EVENT_MULTIVIEW:
		if (x != 0 || y != 0)
		{
			cgs.cursorUpdate = cg.time + 5000;
		} // fall through
	case CGAME_EVENT_SPEAKEREDITOR:
	case CGAME_EVENT_GAMEVIEW:
	case CGAME_EVENT_CAMPAIGNBREIFING:
	case CGAME_EVENT_FIRETEAMMSG:

#ifdef FEATURE_EDV
		if (!cgs.demoCamera.renderingFreeCam)
		{
#endif

		cgs.cursorX += x;
		if (cgs.cursorX < 0)
		{
			cgs.cursorX = 0;
		}
		else if (cgs.cursorX > SCREEN_WIDTH_SAFE)
		{
			cgs.cursorX = SCREEN_WIDTH_SAFE;
		}

		cgs.cursorY += y;
		if (cgs.cursorY < 0)
		{
			cgs.cursorY = 0;
		}
		else if (cgs.cursorY > SCREEN_HEIGHT_SAFE)
		{
			cgs.cursorY = SCREEN_HEIGHT_SAFE;
		}

		if (cgs.eventHandling == CGAME_EVENT_SPEAKEREDITOR)
		{
			CG_SpeakerEditorMouseMove_Handling(x, y);
		}
#ifdef FEATURE_EDV
	}
	else
	{
		// mousemovement *should* feel the same as ingame
		char buffer[64];
		int  mx = 0, my = 0;
		int  mouse_x_pos = 0, mouse_y_pos = 0;

		float sensitivity, m_pitch, m_yaw;
		int   m_filter = 0;

		if (demo_lookat.integer != -1)
		{
			return;
		}

		mx += x;
		my += y;

		trap_Cvar_VariableStringBuffer("m_filter", buffer, sizeof(buffer));
		m_filter = atoi(buffer);

		trap_Cvar_VariableStringBuffer("sensitivity", buffer, sizeof(buffer));
		sensitivity = atof(buffer);

		trap_Cvar_VariableStringBuffer("m_pitch", buffer, sizeof(buffer));
		m_pitch = atof(buffer);

		trap_Cvar_VariableStringBuffer("m_yaw", buffer, sizeof(buffer));
		m_yaw = atof(buffer);

		if (m_filter)
		{
			mouse_x_pos = (mx + old_mouse_x_pos) / 2;
			mouse_y_pos = (my + old_mouse_y_pos) / 2;
		}
		else
		{
			mouse_x_pos = mx;
			mouse_y_pos = my;
		}

		old_mouse_x_pos = mx;
		old_mouse_y_pos = my;

		mouse_x_pos *= sensitivity;
		mouse_y_pos *= sensitivity;

		cg.refdefViewAngles[YAW]   -= m_yaw * mouse_x_pos;
		cg.refdefViewAngles[PITCH] += m_pitch * mouse_y_pos;

		if (cg.refdefViewAngles[PITCH] < -90)
		{
			cg.refdefViewAngles[PITCH] = -90;
		}

		if (cg.refdefViewAngles[PITCH] > 90)
		{
			cg.refdefViewAngles[PITCH] = 90;
		}
	}
#endif
		break;
	default:
		if (cg.snap->ps.pm_type == PM_INTERMISSION)
		{
			CG_Debriefing_MouseEvent(x, y);
			return;
		}

		// default handling
		if ((cg.predictedPlayerState.pm_type == PM_NORMAL ||
		     cg.predictedPlayerState.pm_type == PM_SPECTATOR) &&
		    cg.showScores == qfalse)
		{
			trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_CGAME);
			return;
		}
		break;
	}
}
Example #20
0
void CG_CloseConsole( void ) {
	MField_Clear( &g_consoleField );
	trap_Key_SetCatcher( trap_Key_GetCatcher( ) & ~KEYCATCH_CONSOLE );
	con.finalFrac = 0;				// none visible
	con.displayFrac = 0;
}
Example #21
0
/*
===============
UI_MainMenu

The main menu only comes up when not in a game,
so make sure that the attract loop server is down
and that local cinematics are killed
===============
*/
void UI_MainMenu( void ) {
	int		y;
	qboolean teamArena = qfalse;
	int		style = UI_CENTER | UI_DROPSHADOW;

	trap_Cvar_Set( "sv_killserver", "1" );
	
	memset( &s_main, 0 ,sizeof(mainmenu_t) );
	memset( &s_errorMessage, 0 ,sizeof(errorMessage_t) );

	// com_errorMessage would need that too
	MainMenu_Cache();
	
	trap_Cvar_VariableStringBuffer( "com_errorMessage", s_errorMessage.errorMessage, sizeof(s_errorMessage.errorMessage) );
	if (strlen(s_errorMessage.errorMessage))
	{	
		s_errorMessage.menu.draw = Main_MenuDraw;
		s_errorMessage.menu.key = ErrorMessage_Key;
		s_errorMessage.menu.fullscreen = qtrue;
		s_errorMessage.menu.wrapAround = qtrue;

		trap_Key_SetCatcher( KEYCATCH_UI );
		uis.menusp = 0;
		UI_PushMenu ( &s_errorMessage.menu );
		
		return;
	}

	s_main.menu.draw = Main_MenuDraw;
	s_main.menu.fullscreen = qtrue;
	s_main.menu.wrapAround = qtrue;

	y = 330;
#define PLACE_X 530

	s_main.demos.generic.type				= MTYPE_PTEXT;
	s_main.demos.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.demos.generic.x					= PLACE_X;
	s_main.demos.generic.y					= y;
	s_main.demos.generic.id					= ID_DEMOS;
	s_main.demos.generic.callback			= Main_MenuEvent; 
	s_main.demos.string						= "DEMOS";
	s_main.demos.color						= color_red;
	s_main.demos.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.setup.generic.type				= MTYPE_PTEXT;
	s_main.setup.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.setup.generic.x					= PLACE_X;
	s_main.setup.generic.y					= y;
	s_main.setup.generic.id					= ID_SETUP;
	s_main.setup.generic.callback			= Main_MenuEvent; 
	s_main.setup.string						= "SETUP";
	s_main.setup.color						= color_red;
	s_main.setup.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.credits.generic.type				= MTYPE_PTEXT;
	s_main.credits.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.credits.generic.x				= PLACE_X;
	s_main.credits.generic.y				= y;
	s_main.credits.generic.id				= ID_CREDITS;
	s_main.credits.generic.callback			= Main_MenuEvent; 
	s_main.credits.string					= "CREDITS";
	s_main.credits.color					= color_red;
	s_main.credits.style					= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.exit.generic.type				= MTYPE_PTEXT;
	s_main.exit.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.exit.generic.x					= PLACE_X;
	s_main.exit.generic.y					= y;
	s_main.exit.generic.id					= ID_EXIT;
	s_main.exit.generic.callback			= Main_MenuEvent; 
	s_main.exit.string						= "EXIT";
	s_main.exit.color						= color_red;
	s_main.exit.style						= style;

	Menu_AddItem( &s_main.menu,	&s_main.demos );
	Menu_AddItem( &s_main.menu,	&s_main.setup );
	Menu_AddItem( &s_main.menu,	&s_main.credits );
	Menu_AddItem( &s_main.menu,	&s_main.exit );             

	trap_Key_SetCatcher( KEYCATCH_UI );
	uis.menusp = 0;
	UI_PushMenu ( &s_main.menu );
		
}
Example #22
0
/*
===============
UI_MainMenu

The main menu only comes up when not in a game,
so make sure that the attract loop server is down
and that local cinematics are killed
===============
*/
void UI_MainMenu( void ) {
	int		y;
	qboolean teamArena = qfalse;
	int		style = UI_CENTER | UI_DROPSHADOW | UI_SMALLFONT;
	int type;

	trap_Cvar_Set( "sv_killserver", "1" );

#if 0
	if (0) {  //( !uis.demoversion && !ui_cdkeychecked.integer ) {
		char	key[17];

		trap_GetCDKey( key, sizeof(key) );
		if( trap_VerifyCDKey( key, NULL ) == qfalse ) {
			UI_CDKeyMenu();
			return;
		}
	}
#endif

	memset( &s_main, 0 ,sizeof(mainmenu_t) );
	memset( &s_errorMessage, 0 ,sizeof(errorMessage_t) );

	// com_errorMessage would need that too
	MainMenu_Cache();

	trap_Cvar_VariableStringBuffer( "com_errorMessage", s_errorMessage.errorMessage, sizeof(s_errorMessage.errorMessage) );
	if (strlen(s_errorMessage.errorMessage))
	{
		s_errorMessage.menu.draw = Main_MenuDraw;
		s_errorMessage.menu.key = ErrorMessage_Key;
		s_errorMessage.menu.fullscreen = qtrue;
		s_errorMessage.menu.wrapAround = qtrue;
		s_errorMessage.menu.showlogo = qtrue;

		trap_Key_SetCatcher( KEYCATCH_UI );
		uis.menusp = 0;
		UI_PushMenu ( &s_errorMessage.menu );

		return;
	}

	s_main.menu.draw = Main_MenuDraw;
	s_main.menu.fullscreen = qtrue;
	s_main.menu.wrapAround = qtrue;
	s_main.menu.showlogo = qfalse;  //qtrue;

	type = MTYPE_PTEXT;  //MTYPE_TEXT;  // MTYPE_PTEXT

	y = 134;
	s_main.singleplayer.generic.type		= type;
	s_main.singleplayer.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.singleplayer.generic.x			= 320;
	s_main.singleplayer.generic.y			= y;
	s_main.singleplayer.generic.id			= ID_SINGLEPLAYER;
	s_main.singleplayer.generic.callback	= Main_MenuEvent;
	s_main.singleplayer.string				= "SINGLE PLAYER";
	s_main.singleplayer.color				= color_red;
	s_main.singleplayer.style				= style;

	//y += MAIN_MENU_VERTICAL_SPACING;
	s_main.multiplayer.generic.type			= type;
	s_main.multiplayer.generic.flags		= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.multiplayer.generic.x			= 320;
	s_main.multiplayer.generic.y			= y;
	s_main.multiplayer.generic.id			= ID_MULTIPLAYER;
	s_main.multiplayer.generic.callback		= Main_MenuEvent;
	s_main.multiplayer.string				= "MULTIPLAYER";
	s_main.multiplayer.color				= color_red;
	s_main.multiplayer.style				= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.demos.generic.type				= type;
	s_main.demos.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.demos.generic.x					= 320;
	s_main.demos.generic.y					= y;
	s_main.demos.generic.id					= ID_DEMOS;
	s_main.demos.generic.callback			= Main_MenuEvent;
	s_main.demos.string						= "WOLFCAM-DEMOS";
	s_main.demos.color						= color_red;
	s_main.demos.style						= style;

#if 1
	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.qldemos.generic.type				= type;
	s_main.qldemos.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.qldemos.generic.x					= 320;
	s_main.qldemos.generic.y					= y;
	s_main.qldemos.generic.id					= ID_QLDEMOS;
	s_main.qldemos.generic.callback			= Main_MenuEvent;
	s_main.qldemos.string						= "QUAKELIVE-DEMOS";
	s_main.qldemos.color						= color_red;
	s_main.qldemos.style						= style;
#endif

#if 0
	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.cinematics.generic.type			= type;
	s_main.cinematics.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.cinematics.generic.x				= 320;
	s_main.cinematics.generic.y				= y;
	s_main.cinematics.generic.id			= ID_CINEMATICS;
	s_main.cinematics.generic.callback		= Main_MenuEvent;
	s_main.cinematics.string				= "CINEMATICS";
	s_main.cinematics.color					= color_red;
	s_main.cinematics.style					= style;
#endif

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.setup.generic.type				= type;
	s_main.setup.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.setup.generic.x					= 320;
	s_main.setup.generic.y					= y;
	s_main.setup.generic.id					= ID_SETUP;
	s_main.setup.generic.callback			= Main_MenuEvent;
	s_main.setup.string						= "SETUP";
	s_main.setup.color						= color_red;
	s_main.setup.style						= style;


	if ( !uis.demoversion && UI_TeamArenaExists() ) {
		teamArena = qtrue;
		//y += MAIN_MENU_VERTICAL_SPACING;
		s_main.teamArena.generic.type			= type;
		s_main.teamArena.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
		s_main.teamArena.generic.x				= 320;
		s_main.teamArena.generic.y				= y;
		s_main.teamArena.generic.id				= ID_TEAMARENA;
		s_main.teamArena.generic.callback		= Main_MenuEvent;
		s_main.teamArena.string					= "TEAM ARENA";
		s_main.teamArena.color					= color_red;
		s_main.teamArena.style					= style;
	}

	if ( !uis.demoversion ) {
		//y += MAIN_MENU_VERTICAL_SPACING;
		s_main.mods.generic.type			= type;
		s_main.mods.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
		s_main.mods.generic.x				= 320;
		s_main.mods.generic.y				= y;
		s_main.mods.generic.id				= ID_MODS;
		s_main.mods.generic.callback		= Main_MenuEvent;
		s_main.mods.string					= "MODS";
		s_main.mods.color					= color_red;
		s_main.mods.style					= style;
	}

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.openQuakeLiveDirectory.generic.type				= type;
	s_main.openQuakeLiveDirectory.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.openQuakeLiveDirectory.generic.x					= 320;
	s_main.openQuakeLiveDirectory.generic.y					= y;
	s_main.openQuakeLiveDirectory.generic.id					= ID_OPEN_QUAKE_LIVE_DIRECTORY;
	s_main.openQuakeLiveDirectory.generic.callback			= Main_MenuEvent;
	s_main.openQuakeLiveDirectory.string						= "OPEN QUAKE LIVE DIRECTORY";
	s_main.openQuakeLiveDirectory.color						= color_red;
	s_main.openQuakeLiveDirectory.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.openWolfcamDirectory.generic.type				= type;
	s_main.openWolfcamDirectory.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.openWolfcamDirectory.generic.x					= 320;
	s_main.openWolfcamDirectory.generic.y					= y;
	s_main.openWolfcamDirectory.generic.id					= ID_OPEN_WOLFCAM_DIRECTORY;
	s_main.openWolfcamDirectory.generic.callback			= Main_MenuEvent;
	s_main.openWolfcamDirectory.string						= "OPEN WOLFCAM DIRECTORY";
	s_main.openWolfcamDirectory.color						= color_red;
	s_main.openWolfcamDirectory.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.exit.generic.type				= type;
	s_main.exit.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.exit.generic.x					= 320;
	s_main.exit.generic.y					= y;
	s_main.exit.generic.id					= ID_EXIT;
	s_main.exit.generic.callback			= Main_MenuEvent;
	s_main.exit.string						= "EXIT";
	s_main.exit.color						= color_red;
	s_main.exit.style						= style;

	//Menu_AddItem( &s_main.menu,	&s_main.singleplayer );
	//Menu_AddItem( &s_main.menu,	&s_main.multiplayer );

	if (!uis.showErrorMenu) {
		Menu_AddItem( &s_main.menu,	&s_main.demos );
		Menu_AddItem(&s_main.menu, &s_main.qldemos);
		//Menu_AddItem( &s_main.menu,	&s_main.cinematics );
		if (teamArena) {
			//Menu_AddItem( &s_main.menu,	&s_main.teamArena );
		}
		if ( !uis.demoversion ) {
			//Menu_AddItem( &s_main.menu,	&s_main.mods );
		}
		Menu_AddItem( &s_main.menu,	&s_main.setup );
	}

	Menu_AddItem(&s_main.menu, &s_main.openQuakeLiveDirectory);
	Menu_AddItem(&s_main.menu, &s_main.openWolfcamDirectory);
	Menu_AddItem( &s_main.menu,	&s_main.exit );

	trap_Key_SetCatcher( KEYCATCH_UI );
	uis.menusp = 0;
	UI_PushMenu ( &s_main.menu );
}
Example #23
0
/*
=================
UI_ConsoleCommand
=================
*/
qboolean UI_ConsoleCommand(int realTime)
{
	char           *cmd;
	char           *arg1;

	uiInfo.uiDC.frameTime = realTime - uiInfo.uiDC.realTime;
	uiInfo.uiDC.realTime = realTime;

	cmd = UI_Argv(0);

	// ensure minimum menu data is available
	//Menu_Cache();

	if(Q_stricmp(cmd, "ui_test") == 0)
	{
		UI_ShowPostGame(qtrue);
	}

	if(Q_stricmp(cmd, "ui_report") == 0)
	{
		UI_Report();
		return qtrue;
	}

	if(Q_stricmp(cmd, "ui_load") == 0)
	{
		UI_Load();
		return qtrue;
	}

	if(Q_stricmp(cmd, "remapShader") == 0)
	{
		if(trap_Argc() == 4)
		{
			char            shader1[MAX_QPATH];
			char            shader2[MAX_QPATH];

			Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
			Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
			trap_R_RemapShader(shader1, shader2, UI_Argv(3));
			return qtrue;
		}
	}

	if(Q_stricmp(cmd, "postgame") == 0)
	{
		UI_CalcPostGameStats();
		return qtrue;
	}

	if(Q_stricmp(cmd, "ui_cache") == 0)
	{
		UI_Cache_f();
		return qtrue;
	}

	if(Q_stricmp(cmd, "ui_teamOrders") == 0)
	{
		//UI_TeamOrdersMenu_f();
		return qtrue;
	}

	if(Q_stricmp(cmd, "menu") == 0)
	{
		arg1 = UI_Argv(1);

		if(Menu_Count() > 0)
		{
			trap_Key_SetCatcher(KEYCATCH_UI);
			Menus_ActivateByName(arg1);
			return qtrue;
		}
	}

	if(Q_stricmp(cmd, "closemenus") == 0)
	{
		if(Menu_Count() > 0)
		{
			trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_UI);
			trap_Key_ClearStates();
			trap_Cvar_Set("cl_paused", "0");
			Menus_CloseAll();
			return qtrue;
		}
	}

	return qfalse;
}
Example #24
0
/*
===============
UI_MainMenu

The main menu only comes up when not in a game,
so make sure that the attract loop server is down
and that local cinematics are killed
===============
*/
void UI_MainMenu( void ) {
	int		y;
	qboolean teamArena = qfalse;
	int		style = UI_LEFT | UI_CURSORSHADOW;

	trap_Cvar_Set( "sv_killserver", "1" );

	if( !uis.demoversion && !ui_cdkeychecked.integer ) {
		char	key[17];

		trap_GetCDKey( key, sizeof(key) );
		if( trap_VerifyCDKey( key, NULL ) == qfalse ) {
			UI_CDKeyMenu();
			return;
		}
	}

	memset( &s_main, 0 ,sizeof(mainmenu_t) );

	MainMenu_Cache();

	s_main.menu.draw = Main_MenuDraw;
	s_main.menu.fullscreen = qtrue;
	s_main.menu.wrapAround = qtrue;

	s_main.backleft.generic.type	= MTYPE_BITMAP;
	s_main.backleft.generic.name	= MAIN_BACKGROUND_LEFT;
	s_main.backleft.generic.flags	= QMF_INACTIVE;
	s_main.backleft.generic.x		= 0;  
	s_main.backleft.generic.y		= 120;
	s_main.backleft.width			= 320;
	s_main.backleft.height			= 360;

	s_main.backright.generic.type	= MTYPE_BITMAP;
	s_main.backright.generic.name	= MAIN_BACKGROUND_RIGHT;
	s_main.backright.generic.flags	= QMF_INACTIVE;
	s_main.backright.generic.x		= 320;  
	s_main.backright.generic.y		= 120;
	s_main.backright.width			= 320;
	s_main.backright.height			= 360;

	y = 160;
	s_main.joingame.generic.type			= MTYPE_PTEXT;
	s_main.joingame.generic.flags			= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.joingame.generic.x				= 20;
	s_main.joingame.generic.y				= y;
	s_main.joingame.generic.id				= ID_JOINGAME;
	s_main.joingame.generic.callback		= Main_MenuEvent; 
	s_main.joingame.string					= "JOIN GAME";
	s_main.joingame.color					= color_orange;
	s_main.joingame.style					= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.startserver.generic.type			= MTYPE_PTEXT;
	s_main.startserver.generic.flags		= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.startserver.generic.x			= 20;
	s_main.startserver.generic.y			= y;
	s_main.startserver.generic.id			= ID_STARTSERVER;
	s_main.startserver.generic.callback		= Main_MenuEvent; 
	s_main.startserver.string				= "START SERVER";
	s_main.startserver.color				= color_orange;
	s_main.startserver.style				= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.setup.generic.type				= MTYPE_PTEXT;
	s_main.setup.generic.flags				= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.setup.generic.x					= 20;
	s_main.setup.generic.y					= y;
	s_main.setup.generic.id					= ID_SETUP;
	s_main.setup.generic.callback			= Main_MenuEvent; 
	s_main.setup.string						= "SETUP";
	s_main.setup.color						= color_orange;
	s_main.setup.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.demos.generic.type				= MTYPE_PTEXT;
	s_main.demos.generic.flags				= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.demos.generic.x					= 20;
	s_main.demos.generic.y					= y;
	s_main.demos.generic.id					= ID_DEMOS;
	s_main.demos.generic.callback			= Main_MenuEvent; 
	s_main.demos.string						= "DEMOS";
	s_main.demos.color						= color_orange;
	s_main.demos.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.mods.generic.type				= MTYPE_PTEXT;
	s_main.mods.generic.flags				= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.mods.generic.x					= 20;
	s_main.mods.generic.y					= y;
	s_main.mods.generic.id					= ID_MODS;
	s_main.mods.generic.callback			= Main_MenuEvent; 
	s_main.mods.string						= "MODS";
	s_main.mods.color						= color_orange;
	s_main.mods.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.exit.generic.type				= MTYPE_PTEXT;
	s_main.exit.generic.flags				= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.exit.generic.x					= 20;
	s_main.exit.generic.y					= y;
	s_main.exit.generic.id					= ID_EXIT;
	s_main.exit.generic.callback			= Main_MenuEvent; 
	s_main.exit.string						= "EXIT";
	s_main.exit.color						= color_orange;
	s_main.exit.style						= style;

	Menu_AddItem( &s_main.menu,	&s_main.backleft );
	Menu_AddItem( &s_main.menu,	&s_main.backright );
	Menu_AddItem( &s_main.menu,	&s_main.joingame );
	Menu_AddItem( &s_main.menu,	&s_main.startserver );
	Menu_AddItem( &s_main.menu,	&s_main.setup );
	Menu_AddItem( &s_main.menu,	&s_main.demos );
	Menu_AddItem( &s_main.menu,	&s_main.mods );
	Menu_AddItem( &s_main.menu,	&s_main.exit );             

	uis.addToFavorites = qfalse;
	trap_Key_SetCatcher( KEYCATCH_UI );
	uis.menusp = 0;
	UI_PushMenu ( &s_main.menu );
}
Example #25
0
//set up the menu
void CG_BuyMenu (void) {

    if(cgs.gametype == GT_DUEL && cg.introend < cg.time)
        return;

    if(cg.snap->ps.persistant[PERS_TEAM] >= TEAM_SPECTATOR)
        return;

    if(cg.snap->ps.stats[STAT_HEALTH] <= 0)
        return;

    // if one is too far away from buy-point
    if(!(cg.snap->ps.stats[STAT_FLAGS] & SF_CANBUY) && (cgs.gametype >= GT_RTP))
        return;

    /* as suggested by The Doctor, this test shouldn't be done in cgame, it is already done in game, it removes a bug
    // if it's to late to buy
    if(cg.time - cg.roundstarttime > BUY_TIME && cgs.gametype >= GT_RTP){
    	CG_Printf("60 seconds have passed ... you can't buy anything\n");
    	return;
    }
    */

    // if we're throwing away the gatling and it's being used, abort
    /*if(cg.snap->ps.weapon == WP_GATLING && cg.snap->ps.stats[STAT_GATLING_MODE])
    	return;*/ // weapon change isn't activated anymore when buying and having a gatling

    // show the menu
    if(menuBuy == NULL) {
        menuBuy = Menus_FindByName("buymenu");
        save_menuBuy.x = menuBuy->window.rect.x;
        save_menuBuy.y = menuBuy->window.rect.y;
    }

    if(menuItem == NULL) {
        menuItem = Menus_FindByName("buymenu_items");
        save_menuItem.x = menuItem->window.rect.x;
        save_menuItem.y = menuItem->window.rect.y;
    }

    cgs.cursorX = cgs.cursorY = 0;

    cg.menu = MENU_BUY;
    cg.menustat = 1;
    cg.menumove = qtrue;
    cg.menuitem = 0;
    cg.oldbutton = qfalse;

    CG_ClearFocusses();

    if(cgs.gametype == GT_DUEL) {
        int i;
        // set focus to 1st item
        cg.menuitem = 1;

        for(i=0; i< menuItem->itemCount; i++) {
            if(menuItem->items[i]->window.ownerDraw == CG_BUTTON1) {
                menuItem->items[i]->window.flags |= WINDOW_HASFOCUS;
                break;
            }
        }
    }

    trap_Cvar_Set("cl_menu", "0");
    trap_Key_SetCatcher(KEYCATCH_CGAME);

    // Notify the server we open the buy menu.
    // The "client" engine code will set BUTTON_BUYMENU to usercmd_t.buttons .
    trap_SendConsoleCommand( "+button8" );
}
Example #26
0
/*
==================
CG_EventHandling
==================
*/
void CG_EventHandling( int type, qboolean fForced )
{
//	CG_Printf("EventHandling: %d\n", type);

	if( cg.demoPlayback && type == CGAME_EVENT_NONE && !fForced ) {
		type = CGAME_EVENT_DEMO;
	}

	if( type != CGAME_EVENT_NONE ) {
		trap_Cvar_Set( "cl_bypassMouseInput", 0 );
	}

	switch( type ) {
		// OSP - Demo support
		case CGAME_EVENT_DEMO:
			cgs.fResize = qfalse;
			cgs.fSelect = qfalse;
			cgs.cursorUpdate = cg.time + 10000;
			cgs.timescaleUpdate = cg.time + 4000;
			CG_ScoresUp_f();
			break;

		case CGAME_EVENT_SPEAKEREDITOR:
		case CGAME_EVENT_GAMEVIEW:
		case CGAME_EVENT_NONE:
		case CGAME_EVENT_CAMPAIGNBREIFING:
		case CGAME_EVENT_FIRETEAMMSG:
		case CGAME_EVENT_MULTIVIEW:
		default:
			// default handling (cleanup mostly)
			if( cgs.eventHandling == CGAME_EVENT_HUDEDITOR) {
				// forty - visual hud editor
				cg.hudEditor.showHudEditor = qfalse;
			} else if(cgs.eventHandling == CGAME_EVENT_MULTIVIEW) {
				if( type == -CGAME_EVENT_MULTIVIEW) {
					type = CGAME_EVENT_NONE;
				} else {
					trap_Key_SetCatcher( KEYCATCH_CGAME );
					return;
				}
			} else if( cgs.eventHandling == CGAME_EVENT_GAMEVIEW ) {
				cg.showGameView = qfalse;
				trap_S_FadeBackgroundTrack( 0.0f, 500, 0 );

				trap_S_StopStreamingSound( -1 );
				cg.limboEndCinematicTime = 0;

				if( fForced ) {
					if( cgs.limboLoadoutModified ) {
						trap_SendClientCommand( "rs" );

						cgs.limboLoadoutSelected = qfalse;
					}
				}
			} else if( cgs.eventHandling == CGAME_EVENT_SPEAKEREDITOR ) {
				if( type == -CGAME_EVENT_SPEAKEREDITOR ) {
					type = CGAME_EVENT_NONE;
				} else {
					trap_Key_SetCatcher( KEYCATCH_CGAME );
					return;
				}
			} else if( cgs.eventHandling == CGAME_EVENT_CAMPAIGNBREIFING ) {
				type = CGAME_EVENT_GAMEVIEW;
			} else if( cgs.eventHandling == CGAME_EVENT_FIRETEAMMSG ) {
				cg.showFireteamMenu = qfalse;								
				trap_Cvar_Set( "cl_bypassmouseinput", "0" );
			} else if( cg.snap && cg.snap->ps.pm_type == PM_INTERMISSION && fForced ) {
				trap_UI_Popup( UIMENU_INGAME );
			}


			break;
	}


	cgs.eventHandling = type;

	if(type == CGAME_EVENT_NONE) {
		trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_CGAME);
		ccInitial = qfalse;
		if(cg.demoPlayback && cg.demohelpWindow != SHOW_OFF) {
			CG_ShowHelp_Off(&cg.demohelpWindow);
		}
	} else if( type == CGAME_EVENT_HUDEDITOR ) {
		// forty - visual hud editor
		cg.hudEditor.showHudEditor = qtrue;
		trap_Key_SetCatcher(KEYCATCH_CGAME);
	} else if( type == CGAME_EVENT_MULTIVIEW ) {
		trap_Key_SetCatcher(KEYCATCH_CGAME);
	} else if( type == CGAME_EVENT_GAMEVIEW ) {
		cg.showGameView = qtrue;
		CG_LimboPanel_Setup();
		trap_Key_SetCatcher(KEYCATCH_CGAME);
	} else if( type == CGAME_EVENT_FIRETEAMMSG ) {
		cgs.ftMenuPos = -1;
		cgs.ftMenuMode = 0;
		cg.showFireteamMenu = qtrue;
		trap_Cvar_Set( "cl_bypassmouseinput", "1" );
		trap_Key_SetCatcher(KEYCATCH_CGAME);
	} else {
		trap_Key_SetCatcher(KEYCATCH_CGAME);
	}
}
Example #27
0
void CG_SetKeyCatcher( int catcher )
{
	rocketInfo.keyCatcher = catcher;
	Rocket_SetActiveContext( catcher );
	trap_Key_SetCatcher( catcher );
}
Example #28
0
/*
=================
UI_SPLevelMenu_f
=================
*/
void UI_SPLevelMenu_f( void ) {
	trap_Key_SetCatcher( KEYCATCH_UI );
	uis.menusp = 0;
	UI_SPLevelMenu();
}
Example #29
0
/*
===============
UI_MainMenu

The main menu only comes up when not in a game,
so make sure that the attract loop server is down
and that local cinematics are killed
===============
 */
void UI_MainMenu(void) {
    int x, y;
    int style = UI_LEFT | UI_DROPSHADOW | UI_SMALLFONT;

    trap_Cvar_Set("sv_killserver", "1");

    memset(&s_main, 0, sizeof (mainmenu_t));
    memset(&s_errorMessage, 0, sizeof (errorMessage_t));

    MainMenu_Cache();

    trap_Cvar_VariableStringBuffer("com_errorMessage", s_errorMessage.errorMessage, sizeof (s_errorMessage.errorMessage));
    if (strlen(s_errorMessage.errorMessage)) {
        s_errorMessage.menu.draw = Main_MenuDraw;
        s_errorMessage.menu.key = ErrorMessage_Key;
        s_errorMessage.menu.fullscreen = qtrue;
        s_errorMessage.menu.wrapAround = qtrue;
        s_errorMessage.menu.showlogo = qtrue;

        trap_Key_SetCatcher(KEYCATCH_UI);
        uis.menusp = 0;
        UI_PushMenu(&s_errorMessage.menu);

        return;
    }

    trap_S_StartBackgroundTrack("music/mainmenu.ogg", "");

    s_main.menu.draw = Main_MenuDraw;
    s_main.menu.fullscreen = qtrue;
    s_main.menu.wrapAround = qtrue;
    s_main.menu.showlogo = qfalse;

    s_main.fade = -100.0f;
    s_main.up = qtrue;

    x = 40;
    s_main.multiplayer.generic.type = MTYPE_PTEXT;
    s_main.multiplayer.generic.flags = QMF_LEFT_JUSTIFY | QMF_PULSEIFFOCUS;
    s_main.multiplayer.generic.x = x;
    s_main.multiplayer.generic.y = 440;
    s_main.multiplayer.generic.id = ID_MULTIPLAYER;
    s_main.multiplayer.generic.callback = Main_MenuEvent;
    s_main.multiplayer.string = "Multiplayer";
    s_main.multiplayer.color = color_blue;
    s_main.multiplayer.style = style;

    x += MAIN_MENU_HORIZONTAL_SPACING;
    s_main.singleplayer.generic.type = MTYPE_PTEXT;
    s_main.singleplayer.generic.flags = QMF_LEFT_JUSTIFY | QMF_PULSEIFFOCUS;
    s_main.singleplayer.generic.x = x;
    s_main.singleplayer.generic.y = 440;
    s_main.singleplayer.generic.id = ID_SINGLEPLAYER;
    s_main.singleplayer.generic.callback = Main_MenuEvent;
    s_main.singleplayer.string = "Singleplayer";
    s_main.singleplayer.color = color_blue;
    s_main.singleplayer.style = style;

    x += MAIN_MENU_HORIZONTAL_SPACING;
    s_main.options.generic.type = MTYPE_PTEXT;
    s_main.options.generic.flags = QMF_LEFT_JUSTIFY | QMF_PULSEIFFOCUS;
    s_main.options.generic.x = x;
    s_main.options.generic.y = 440;
    s_main.options.generic.id = ID_OPTIONS;
    s_main.options.generic.callback = Main_MenuEvent;
    s_main.options.string = "Options";
    s_main.options.color = color_blue;
    s_main.options.style = style;

    x += MAIN_MENU_HORIZONTAL_SPACING;
    s_main.demos.generic.type = MTYPE_PTEXT;
    s_main.demos.generic.flags = QMF_LEFT_JUSTIFY | QMF_PULSEIFFOCUS;
    s_main.demos.generic.x = x;
    s_main.demos.generic.y = 440;
    s_main.demos.generic.id = ID_DEMOS;
    s_main.demos.generic.callback = Main_MenuEvent;
    s_main.demos.string = "Demos";
    s_main.demos.color = color_blue;
    s_main.demos.style = style;

    x += MAIN_MENU_HORIZONTAL_SPACING;
    s_main.exit.generic.type = MTYPE_PTEXT;
    s_main.exit.generic.flags = QMF_LEFT_JUSTIFY | QMF_PULSEIFFOCUS;
    s_main.exit.generic.x = x;
    s_main.exit.generic.y = 440;
    s_main.exit.generic.id = ID_EXIT;
    s_main.exit.generic.callback = Main_MenuEvent;
    s_main.exit.string = "Exit";
    s_main.exit.color = color_blue;
    s_main.exit.style = style;

    Menu_AddItem(&s_main.menu, &s_main.multiplayer);
    Menu_AddItem(&s_main.menu, &s_main.singleplayer);
    Menu_AddItem(&s_main.menu, &s_main.options);
    Menu_AddItem(&s_main.menu, &s_main.demos);
    Menu_AddItem(&s_main.menu, &s_main.exit);

    s_main.servers = (int) trap_Cvar_VariableValue("ma_servers");
    s_main.players = (int) trap_Cvar_VariableValue("ma_players");
    s_main.motd = UI_Cvar_VariableString("ma_motd");

    trap_Key_SetCatcher(KEYCATCH_UI);
    uis.menusp = 0;
    UI_PushMenu(&s_main.menu);

}