Exemplo n.º 1
0
static void M_Custom_Init( void )
{
	menucommon_t *menuitem = NULL;
	int yoffset = 40;
	int i, count;

	s_custom_menu.nitems = 0;

	// parse the command line to create the buttons

	if( trap_Cmd_Argc() < 1 )
		return;

	// first one is always the tittle

	menuitem = UI_InitMenuItem( "m_custom_title1", trap_Cmd_Argv( 1 ), 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL );
	Menu_AddItem( &s_custom_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );

	yoffset += trap_SCR_strHeight( menuitem->font );

	// from now on each 2 new arguments define a new button
	for( i = 2, count = 0; i < trap_Cmd_Argc(); i += 2, count++ )
	{
		menuitem = UI_InitMenuItem( va( "m_custom_button%i", count ), trap_Cmd_Argv( i ), 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_Custom_ExecuteButton );
		menuitem->itemlocal = UI_CopyString( trap_Cmd_Argv( i + 1 ) );
		Menu_AddItem( &s_custom_menu, menuitem );
		yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;
	}

	Menu_Center( &s_custom_menu );
	Menu_Init( &s_custom_menu, qtrue );
	Menu_SetStatusBar( &s_custom_menu, NULL );
}
Exemplo n.º 2
0
static void M_Menu_Login_Init( void )
{
	menucommon_t *menuitem;
	int yoffset = 0;

	menuitem = UI_InitMenuItem( "m_login_title_1", "WARSOW LOGIN", 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL );
	Menu_AddItem( &s_login_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );
	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_login_email", "email", 0, yoffset, MTYPE_FIELD, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
	UI_SetupField( menuitem, "", MAX_EMAIL_LENGTH, 200 );
	Menu_AddItem( &s_login_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_login_pass", "password", 0, yoffset, MTYPE_FIELD, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
	UI_SetupField( menuitem, "", MAX_PASS_LENGTH, 150 );
	UI_SetupFlags( menuitem, F_PASSWORD );
	Menu_AddItem( &s_login_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );

	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_login_back", "back", -70, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_genericBackFunc );
	Menu_AddItem( &s_login_menu, menuitem );

	menuitem = UI_InitMenuItem( "m_login_submit", "login", -25, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_Login_Login );
	Menu_AddItem( &s_login_menu, menuitem );

	menuitem = UI_InitMenuItem( "m_login_register", "register", 20, yoffset, MTYPE_ACTION, ALIGN_LEFT_TOP, uis.fontSystemBig, M_Login_Register );
	Menu_AddItem( &s_login_menu, menuitem );

	Menu_Center( &s_login_menu );
	Menu_Init( &s_login_menu, qfalse );
}
Exemplo n.º 3
0
static void M_MainInit( void )
{
	int yoffset = 0;
	menucommon_t *menuitem;

	s_main_menu.nitems = 0;

	menuitem = UI_InitMenuItem( "m_main_title1", "MAIN MENU", 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );

	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_main_join_game", "find a game", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, JoinNetworkServerFunc );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

#ifdef MATCHMAKER_SUPPORT
	menuitem = UI_InitMenuItem( "m_main_matchmaker", "match maker", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, MatchMakerFunc );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );
#endif

	menuitem = UI_InitMenuItem( "m_main_tutorials", "tutorials", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, TutorialsFunc );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

	menuitem = UI_InitMenuItem( "m_main_setup", "setup", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, SetUpMenuFunc );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

	menuitem = UI_InitMenuItem( "m_main_start_server", "start local game", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, StartNetworkServerFunc );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

	menuitem = UI_InitMenuItem( "m_main_demos", "demos", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, DemosMenuFunc );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

	menuitem = UI_InitMenuItem( "m_main_mods", "mods", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, ModsMenuFunc );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

	menuitem = UI_InitMenuItem( "m_main_console", "console", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, ConsoleFunc );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

	menuitem = UI_InitMenuItem( "m_main_quit", "quit", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, QuitMenuFunc );
	Menu_AddItem( &s_main_menu, menuitem );
	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

	Menu_Center( &s_main_menu );
	Menu_Init( &s_main_menu, qtrue );

	Menu_SetStatusBar( &s_main_menu, main_menu_statusbar[0] ? main_menu_statusbar : NULL );
}
Exemplo n.º 4
0
void Multiplayer_MenuInit( void )
{
	s_multiplayer_menu.x = SCREEN_WIDTH*0.5 - 64;
//	s_multiplayer_menu.y = 0;
	s_multiplayer_menu.nitems = 0;

	s_join_network_server_action.generic.type	= MTYPE_ACTION;
	s_join_network_server_action.generic.flags  = QMF_LEFT_JUSTIFY;
	s_join_network_server_action.generic.x		= 0;
	s_join_network_server_action.generic.y		= 0;
	s_join_network_server_action.generic.name	= " join network server";
	s_join_network_server_action.generic.callback = JoinNetworkServerFunc;

	s_start_network_server_action.generic.type	= MTYPE_ACTION;
	s_start_network_server_action.generic.flags  = QMF_LEFT_JUSTIFY;
	s_start_network_server_action.generic.x		= 0;
	s_start_network_server_action.generic.y		= 2*MENU_FONT_SIZE;
	s_start_network_server_action.generic.name	= " start network server";
	s_start_network_server_action.generic.callback = StartNetworkServerFunc;

	s_player_setup_action.generic.type	= MTYPE_ACTION;
	s_player_setup_action.generic.flags  = QMF_LEFT_JUSTIFY;
	s_player_setup_action.generic.x		= 0;
	s_player_setup_action.generic.y		= 4*MENU_FONT_SIZE;
	s_player_setup_action.generic.name	= " player setup";
	s_player_setup_action.generic.callback = PlayerSetupFunc;

	s_download_options_action.generic.type = MTYPE_ACTION;
	s_download_options_action.generic.flags = QMF_LEFT_JUSTIFY;
	s_download_options_action.generic.x	= 0;
	s_download_options_action.generic.y	= 6*MENU_FONT_SIZE;
	s_download_options_action.generic.name	= " download options";
	s_download_options_action.generic.callback = DownloadOptionsFunc;

	s_backmain_action.generic.type	= MTYPE_ACTION;
	s_backmain_action.generic.flags  = QMF_LEFT_JUSTIFY;
	s_backmain_action.generic.x		= 0;
	s_backmain_action.generic.y		= 9*MENU_FONT_SIZE;
	s_backmain_action.generic.name	= " back to main";
	s_backmain_action.generic.callback = UI_BackMenu;

	Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_join_network_server_action );
	Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_start_network_server_action );
	Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_player_setup_action );
	Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_download_options_action );
	Menu_AddItem( &s_multiplayer_menu, ( void * ) &s_backmain_action );

	Menu_SetStatusBar( &s_multiplayer_menu, NULL );

	Menu_Center( &s_multiplayer_menu );
}
Exemplo n.º 5
0
/*
** VID_MenuInit
*/
void VID_MenuInit( void )
{
	static const char *resolutions[] = 
	{
		"[320 240  ]",
		"[400 300  ]",
		"[512 384  ]",
		"[640 480  ]",
		"[800 600  ]",
		"[960 720  ]",
		"[1024 768 ]",
		"[1152 864 ]",
		"[1280 1024]",
		"[1600 1200]",
		0
	};
	static const char *refs[] =
	{
		"[software      ]",
		"[default OpenGL]",
		0
	};
	static const char *yesno_names[] =
	{
		"no",
		"yes",
		0
	};
	int i;

	if ( !gl_driver )
		gl_driver = Cvar_Get( "gl_driver", "opengl32", 0 );
	if ( !gl_picmip )
		gl_picmip = Cvar_Get( "gl_picmip", "0", 0 );
	if ( !gl_mode )
		gl_mode = Cvar_Get( "gl_mode", "3", 0 );
	if ( !sw_mode )
		sw_mode = Cvar_Get( "sw_mode", "0", 0 );
	if ( !gl_ext_palettedtexture )
		gl_ext_palettedtexture = Cvar_Get( "gl_ext_palettedtexture", "1", CVAR_ARCHIVE );

	if ( !sw_stipplealpha )
		sw_stipplealpha = Cvar_Get( "sw_stipplealpha", "0", CVAR_ARCHIVE );

	if ( !_windowed_mouse)
        _windowed_mouse = Cvar_Get( "_windowed_mouse", "0", CVAR_ARCHIVE );

	s_mode_list[SOFTWARE_MENU].curvalue = sw_mode->value;
	s_mode_list[OPENGL_MENU].curvalue = gl_mode->value;

	if ( !scr_viewsize )
		scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE);

	s_screensize_slider[SOFTWARE_MENU].curvalue = scr_viewsize->value/10;
	s_screensize_slider[OPENGL_MENU].curvalue = scr_viewsize->value/10;

	if (strcmp( vid_ref->string, "soft" ) == 0 ) 
	{
		s_current_menu_index = SOFTWARE_MENU;
		s_ref_list[0].curvalue = s_ref_list[1].curvalue = REF_SOFT;
	}
	else if ( strcmp( vid_ref->string, "gl" ) == 0 )
	{
		s_current_menu_index = OPENGL_MENU;
		s_ref_list[s_current_menu_index].curvalue = REF_OPENGL;
#if 0
		if ( strcmp( gl_driver->string, "3dfxgl" ) == 0 )
			s_ref_list[s_current_menu_index].curvalue = REF_3DFX;
		else if ( strcmp( gl_driver->string, "pvrgl" ) == 0 )
			s_ref_list[s_current_menu_index].curvalue = REF_POWERVR;
		else if ( strcmp( gl_driver->string, "opengl32" ) == 0 )
			s_ref_list[s_current_menu_index].curvalue = REF_OPENGL;
		else
			s_ref_list[s_current_menu_index].curvalue = REF_VERITE;
#endif
	}

	s_software_menu.x = viddef.width * 0.50;
	s_software_menu.nitems = 0;
	s_opengl_menu.x = viddef.width * 0.50;
	s_opengl_menu.nitems = 0;

	for ( i = 0; i < 2; i++ )
	{
		s_ref_list[i].generic.type = MTYPE_SPINCONTROL;
		s_ref_list[i].generic.name = "driver";
		s_ref_list[i].generic.x = 0;
		s_ref_list[i].generic.y = 0;
		s_ref_list[i].generic.callback = DriverCallback;
		s_ref_list[i].itemnames = refs;

		s_mode_list[i].generic.type = MTYPE_SPINCONTROL;
		s_mode_list[i].generic.name = "video mode";
		s_mode_list[i].generic.x = 0;
		s_mode_list[i].generic.y = 10;
		s_mode_list[i].itemnames = resolutions;

		s_screensize_slider[i].generic.type	= MTYPE_SLIDER;
		s_screensize_slider[i].generic.x		= 0;
		s_screensize_slider[i].generic.y		= 20;
		s_screensize_slider[i].generic.name	= "screen size";
		s_screensize_slider[i].minvalue = 3;
		s_screensize_slider[i].maxvalue = 12;
		s_screensize_slider[i].generic.callback = ScreenSizeCallback;

		s_brightness_slider[i].generic.type	= MTYPE_SLIDER;
		s_brightness_slider[i].generic.x	= 0;
		s_brightness_slider[i].generic.y	= 30;
		s_brightness_slider[i].generic.name	= "brightness";
		s_brightness_slider[i].generic.callback = BrightnessCallback;
		s_brightness_slider[i].minvalue = 5;
		s_brightness_slider[i].maxvalue = 13;
		s_brightness_slider[i].curvalue = ( 1.3 - vid_gamma->value + 0.5 ) * 10;

		s_fs_box[i].generic.type = MTYPE_SPINCONTROL;
		s_fs_box[i].generic.x	= 0;
		s_fs_box[i].generic.y	= 40;
		s_fs_box[i].generic.name	= "fullscreen";
		s_fs_box[i].itemnames = yesno_names;
		s_fs_box[i].curvalue = vid_fullscreen->value;

		s_defaults_action[i].generic.type = MTYPE_ACTION;
		s_defaults_action[i].generic.name = "reset to default";
		s_defaults_action[i].generic.x    = 0;
		s_defaults_action[i].generic.y    = 90;
		s_defaults_action[i].generic.callback = ResetDefaults;

		s_apply_action[i].generic.type = MTYPE_ACTION;
		s_apply_action[i].generic.name = "apply";
		s_apply_action[i].generic.x    = 0;
		s_apply_action[i].generic.y    = 100;
		s_apply_action[i].generic.callback = ApplyChanges;
	}

	s_stipple_box.generic.type = MTYPE_SPINCONTROL;
	s_stipple_box.generic.x	= 0;
	s_stipple_box.generic.y	= 60;
	s_stipple_box.generic.name	= "stipple alpha";
	s_stipple_box.curvalue = sw_stipplealpha->value;
	s_stipple_box.itemnames = yesno_names;

	s_windowed_mouse.generic.type = MTYPE_SPINCONTROL;
	s_windowed_mouse.generic.x  = 0;
	s_windowed_mouse.generic.y  = 72;
	s_windowed_mouse.generic.name   = "windowed mouse";
	s_windowed_mouse.curvalue = _windowed_mouse->value;
	s_windowed_mouse.itemnames = yesno_names;

	s_tq_slider.generic.type	= MTYPE_SLIDER;
	s_tq_slider.generic.x		= 0;
	s_tq_slider.generic.y		= 60;
	s_tq_slider.generic.name	= "texture quality";
	s_tq_slider.minvalue = 0;
	s_tq_slider.maxvalue = 3;
	s_tq_slider.curvalue = 3-gl_picmip->value;

	s_paletted_texture_box.generic.type = MTYPE_SPINCONTROL;
	s_paletted_texture_box.generic.x	= 0;
	s_paletted_texture_box.generic.y	= 70;
	s_paletted_texture_box.generic.name	= "8-bit textures";
	s_paletted_texture_box.itemnames = yesno_names;
	s_paletted_texture_box.curvalue = gl_ext_palettedtexture->value;

	Menu_AddItem( &s_software_menu, ( void * ) &s_ref_list[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_mode_list[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_screensize_slider[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_brightness_slider[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_fs_box[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_stipple_box );
	Menu_AddItem( &s_software_menu, ( void * ) &s_windowed_mouse );

	Menu_AddItem( &s_opengl_menu, ( void * ) &s_ref_list[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_mode_list[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_screensize_slider[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_brightness_slider[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_fs_box[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_tq_slider );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_paletted_texture_box );

	Menu_AddItem( &s_software_menu, ( void * ) &s_defaults_action[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_apply_action[SOFTWARE_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_defaults_action[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_apply_action[OPENGL_MENU] );

	Menu_Center( &s_software_menu );
	Menu_Center( &s_opengl_menu );
	s_opengl_menu.x -= 8;
	s_software_menu.x -= 8;
}
Exemplo n.º 6
0
static void Keys_MenuInit( void )
{
	int y = 0;
	int i = 0;

	memset(&s_keys_menu, 0, sizeof(s_keys_menu));
	s_keys_menu.x = viddef.width * 0.50;
	s_keys_menu.nitems = 0;
	s_keys_menu.cursordraw = KeyCursorDrawFunc;

	s_keys_attack_action.generic.type	= MTYPE_ACTION;
	s_keys_attack_action.generic.flags  = QMF_GRAYED;
	s_keys_attack_action.generic.x		= 0;
	s_keys_attack_action.generic.y		= y;
	s_keys_attack_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_attack_action.generic.localdata[0] = i;
	s_keys_attack_action.generic.name	= bindnames[s_keys_attack_action.generic.localdata[0]][1];

	s_keys_change_weapon_action.generic.type	= MTYPE_ACTION;
	s_keys_change_weapon_action.generic.flags  = QMF_GRAYED;
	s_keys_change_weapon_action.generic.x		= 0;
	s_keys_change_weapon_action.generic.y		= y += 9;
	s_keys_change_weapon_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_change_weapon_action.generic.localdata[0] = ++i;
	s_keys_change_weapon_action.generic.name	= bindnames[s_keys_change_weapon_action.generic.localdata[0]][1];

	s_keys_walk_forward_action.generic.type	= MTYPE_ACTION;
	s_keys_walk_forward_action.generic.flags  = QMF_GRAYED;
	s_keys_walk_forward_action.generic.x		= 0;
	s_keys_walk_forward_action.generic.y		= y += 9;
	s_keys_walk_forward_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_walk_forward_action.generic.localdata[0] = ++i;
	s_keys_walk_forward_action.generic.name	= bindnames[s_keys_walk_forward_action.generic.localdata[0]][1];

	s_keys_backpedal_action.generic.type	= MTYPE_ACTION;
	s_keys_backpedal_action.generic.flags  = QMF_GRAYED;
	s_keys_backpedal_action.generic.x		= 0;
	s_keys_backpedal_action.generic.y		= y += 9;
	s_keys_backpedal_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_backpedal_action.generic.localdata[0] = ++i;
	s_keys_backpedal_action.generic.name	= bindnames[s_keys_backpedal_action.generic.localdata[0]][1];

	s_keys_turn_left_action.generic.type	= MTYPE_ACTION;
	s_keys_turn_left_action.generic.flags  = QMF_GRAYED;
	s_keys_turn_left_action.generic.x		= 0;
	s_keys_turn_left_action.generic.y		= y += 9;
	s_keys_turn_left_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_turn_left_action.generic.localdata[0] = ++i;
	s_keys_turn_left_action.generic.name	= bindnames[s_keys_turn_left_action.generic.localdata[0]][1];

	s_keys_turn_right_action.generic.type	= MTYPE_ACTION;
	s_keys_turn_right_action.generic.flags  = QMF_GRAYED;
	s_keys_turn_right_action.generic.x		= 0;
	s_keys_turn_right_action.generic.y		= y += 9;
	s_keys_turn_right_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_turn_right_action.generic.localdata[0] = ++i;
	s_keys_turn_right_action.generic.name	= bindnames[s_keys_turn_right_action.generic.localdata[0]][1];

	s_keys_run_action.generic.type	= MTYPE_ACTION;
	s_keys_run_action.generic.flags  = QMF_GRAYED;
	s_keys_run_action.generic.x		= 0;
	s_keys_run_action.generic.y		= y += 9;
	s_keys_run_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_run_action.generic.localdata[0] = ++i;
	s_keys_run_action.generic.name	= bindnames[s_keys_run_action.generic.localdata[0]][1];

	s_keys_step_left_action.generic.type	= MTYPE_ACTION;
	s_keys_step_left_action.generic.flags  = QMF_GRAYED;
	s_keys_step_left_action.generic.x		= 0;
	s_keys_step_left_action.generic.y		= y += 9;
	s_keys_step_left_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_step_left_action.generic.localdata[0] = ++i;
	s_keys_step_left_action.generic.name	= bindnames[s_keys_step_left_action.generic.localdata[0]][1];

	s_keys_step_right_action.generic.type	= MTYPE_ACTION;
	s_keys_step_right_action.generic.flags  = QMF_GRAYED;
	s_keys_step_right_action.generic.x		= 0;
	s_keys_step_right_action.generic.y		= y += 9;
	s_keys_step_right_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_step_right_action.generic.localdata[0] = ++i;
	s_keys_step_right_action.generic.name	= bindnames[s_keys_step_right_action.generic.localdata[0]][1];

	s_keys_sidestep_action.generic.type	= MTYPE_ACTION;
	s_keys_sidestep_action.generic.flags  = QMF_GRAYED;
	s_keys_sidestep_action.generic.x		= 0;
	s_keys_sidestep_action.generic.y		= y += 9;
	s_keys_sidestep_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_sidestep_action.generic.localdata[0] = ++i;
	s_keys_sidestep_action.generic.name	= bindnames[s_keys_sidestep_action.generic.localdata[0]][1];

	s_keys_look_up_action.generic.type	= MTYPE_ACTION;
	s_keys_look_up_action.generic.flags  = QMF_GRAYED;
	s_keys_look_up_action.generic.x		= 0;
	s_keys_look_up_action.generic.y		= y += 9;
	s_keys_look_up_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_look_up_action.generic.localdata[0] = ++i;
	s_keys_look_up_action.generic.name	= bindnames[s_keys_look_up_action.generic.localdata[0]][1];

	s_keys_look_down_action.generic.type	= MTYPE_ACTION;
	s_keys_look_down_action.generic.flags  = QMF_GRAYED;
	s_keys_look_down_action.generic.x		= 0;
	s_keys_look_down_action.generic.y		= y += 9;
	s_keys_look_down_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_look_down_action.generic.localdata[0] = ++i;
	s_keys_look_down_action.generic.name	= bindnames[s_keys_look_down_action.generic.localdata[0]][1];

	s_keys_center_view_action.generic.type	= MTYPE_ACTION;
	s_keys_center_view_action.generic.flags  = QMF_GRAYED;
	s_keys_center_view_action.generic.x		= 0;
	s_keys_center_view_action.generic.y		= y += 9;
	s_keys_center_view_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_center_view_action.generic.localdata[0] = ++i;
	s_keys_center_view_action.generic.name	= bindnames[s_keys_center_view_action.generic.localdata[0]][1];

	s_keys_mouse_look_action.generic.type	= MTYPE_ACTION;
	s_keys_mouse_look_action.generic.flags  = QMF_GRAYED;
	s_keys_mouse_look_action.generic.x		= 0;
	s_keys_mouse_look_action.generic.y		= y += 9;
	s_keys_mouse_look_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_mouse_look_action.generic.localdata[0] = ++i;
	s_keys_mouse_look_action.generic.name	= bindnames[s_keys_mouse_look_action.generic.localdata[0]][1];

	s_keys_keyboard_look_action.generic.type	= MTYPE_ACTION;
	s_keys_keyboard_look_action.generic.flags  = QMF_GRAYED;
	s_keys_keyboard_look_action.generic.x		= 0;
	s_keys_keyboard_look_action.generic.y		= y += 9;
	s_keys_keyboard_look_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_keyboard_look_action.generic.localdata[0] = ++i;
	s_keys_keyboard_look_action.generic.name	= bindnames[s_keys_keyboard_look_action.generic.localdata[0]][1];

	s_keys_move_up_action.generic.type	= MTYPE_ACTION;
	s_keys_move_up_action.generic.flags  = QMF_GRAYED;
	s_keys_move_up_action.generic.x		= 0;
	s_keys_move_up_action.generic.y		= y += 9;
	s_keys_move_up_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_move_up_action.generic.localdata[0] = ++i;
	s_keys_move_up_action.generic.name	= bindnames[s_keys_move_up_action.generic.localdata[0]][1];

	s_keys_move_down_action.generic.type	= MTYPE_ACTION;
	s_keys_move_down_action.generic.flags  = QMF_GRAYED;
	s_keys_move_down_action.generic.x		= 0;
	s_keys_move_down_action.generic.y		= y += 9;
	s_keys_move_down_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_move_down_action.generic.localdata[0] = ++i;
	s_keys_move_down_action.generic.name	= bindnames[s_keys_move_down_action.generic.localdata[0]][1];

	s_keys_inventory_action.generic.type	= MTYPE_ACTION;
	s_keys_inventory_action.generic.flags  = QMF_GRAYED;
	s_keys_inventory_action.generic.x		= 0;
	s_keys_inventory_action.generic.y		= y += 9;
	s_keys_inventory_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_inventory_action.generic.localdata[0] = ++i;
	s_keys_inventory_action.generic.name	= bindnames[s_keys_inventory_action.generic.localdata[0]][1];

	s_keys_inv_use_action.generic.type	= MTYPE_ACTION;
	s_keys_inv_use_action.generic.flags  = QMF_GRAYED;
	s_keys_inv_use_action.generic.x		= 0;
	s_keys_inv_use_action.generic.y		= y += 9;
	s_keys_inv_use_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_inv_use_action.generic.localdata[0] = ++i;
	s_keys_inv_use_action.generic.name	= bindnames[s_keys_inv_use_action.generic.localdata[0]][1];

	s_keys_inv_drop_action.generic.type	= MTYPE_ACTION;
	s_keys_inv_drop_action.generic.flags  = QMF_GRAYED;
	s_keys_inv_drop_action.generic.x		= 0;
	s_keys_inv_drop_action.generic.y		= y += 9;
	s_keys_inv_drop_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_inv_drop_action.generic.localdata[0] = ++i;
	s_keys_inv_drop_action.generic.name	= bindnames[s_keys_inv_drop_action.generic.localdata[0]][1];

	s_keys_inv_prev_action.generic.type	= MTYPE_ACTION;
	s_keys_inv_prev_action.generic.flags  = QMF_GRAYED;
	s_keys_inv_prev_action.generic.x		= 0;
	s_keys_inv_prev_action.generic.y		= y += 9;
	s_keys_inv_prev_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_inv_prev_action.generic.localdata[0] = ++i;
	s_keys_inv_prev_action.generic.name	= bindnames[s_keys_inv_prev_action.generic.localdata[0]][1];

	s_keys_inv_next_action.generic.type	= MTYPE_ACTION;
	s_keys_inv_next_action.generic.flags  = QMF_GRAYED;
	s_keys_inv_next_action.generic.x		= 0;
	s_keys_inv_next_action.generic.y		= y += 9;
	s_keys_inv_next_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_inv_next_action.generic.localdata[0] = ++i;
	s_keys_inv_next_action.generic.name	= bindnames[s_keys_inv_next_action.generic.localdata[0]][1];

	s_keys_help_computer_action.generic.type	= MTYPE_ACTION;
	s_keys_help_computer_action.generic.flags  = QMF_GRAYED;
	s_keys_help_computer_action.generic.x		= 0;
	s_keys_help_computer_action.generic.y		= y += 9;
	s_keys_help_computer_action.generic.ownerdraw = DrawKeyBindingFunc;
	s_keys_help_computer_action.generic.localdata[0] = ++i;
	s_keys_help_computer_action.generic.name	= bindnames[s_keys_help_computer_action.generic.localdata[0]][1];

	s_keys_menu.draw = Keys_MenuDraw;
	s_keys_menu.key = Keys_MenuKey;

	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_attack_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_change_weapon_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_walk_forward_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_backpedal_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_turn_left_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_turn_right_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_run_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_step_left_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_step_right_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_sidestep_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_look_up_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_look_down_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_center_view_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_mouse_look_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_keyboard_look_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_move_up_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_move_down_action );

	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inventory_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inv_use_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inv_drop_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inv_prev_action );
	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_inv_next_action );

	Menu_AddItem( &s_keys_menu, ( void * ) &s_keys_help_computer_action );
	
	Menu_SetStatusBar( &s_keys_menu, "enter to change, backspace to clear" );
	Menu_Center( &s_keys_menu );
}
Exemplo n.º 7
0
static void M_Msgbox_Init( void )
{
	int i, j, s;
	int lineend, len;
	int n = 0;
	const char *p;
	menucommon_t *menuitem = NULL;
	char menuitem_name[40];
	char scnd_btn_name[120] = { '\0' }, scnd_btn_action[120] = { '\0' };
	int width = 0, yoffset = 40;

	s_msgbox_menu.nitems = 0;

	mbtext[0] = 0;

	for( i = 1; i < trap_Cmd_Argc(); i++ )
	{
		Q_strncpyz( mbtext, trap_Cmd_Argv(i), sizeof( mbtext ) );
		len = strlen( mbtext );

		// a secret second button
		if( !strncmp( mbtext, "\\btn\\", 5 ) )
		{
			p = strstr( mbtext + 6, "\\" );
			if( p ) {
				mbtext[p - mbtext] = '\0';

				Q_strncpyz( scnd_btn_name, mbtext + 5, sizeof( scnd_btn_name ) );
				Q_strncpyz( scnd_btn_action, p + 1, sizeof( scnd_btn_action ) );
			}

			continue;
		}

		// split the text into lines
		for( s = 0; s <= len; s += j + 1 )
		{
			lineend = min( len - s, M_MSGBOX_LINELEN );

			for( j = lineend; j && mbtext[s+j] && mbtext[s+j] != ' '; j-- );
			if( !j ) j = lineend;

			mbtext[s+j] = '\0';

			Q_snprintfz( menuitem_name, sizeof( menuitem_name ), "m_msgbox_textline_%i", n );
			menuitem = UI_InitMenuItem( menuitem_name, mbtext + s, 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemSmall, NULL );
			Menu_AddItem( &s_msgbox_menu, menuitem );
			yoffset += trap_SCR_strHeight( menuitem->font );

			n++;
		}
	}

	//if we printed something, add one line separation
	if( menuitem )
		yoffset += trap_SCR_strHeight( menuitem->font );

	if( scnd_btn_name[0] && scnd_btn_action[0] )
		width = UI_StringWidth( "close", uis.fontSystemBig );
	else
		width = 0;

	menuitem = UI_InitMenuItem( "m_msgbox_close", "close", -width, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_genericBackFunc );
	Menu_AddItem( &s_msgbox_menu, menuitem );

	if( scnd_btn_name[0] && scnd_btn_action[0] )
	{
		UI_SetupButton( menuitem, qtrue );

		menuitem = UI_InitMenuItem( "m_msgbox_connect", scnd_btn_name, width, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_Msgbox_SecondButton );
		menuitem->itemlocal = UI_CopyString( scnd_btn_action );
		Menu_AddItem( &s_msgbox_menu, menuitem );
	}

	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

	Menu_Center( &s_msgbox_menu );
	Menu_Init( &s_msgbox_menu, qfalse );
	Menu_SetStatusBar( &s_msgbox_menu, NULL );
}
Exemplo n.º 8
0
void
VID_MenuInit(void)
{
	int y = 0;

	static const char *resolutions[] = {
		"[320 240  ]",
		"[400 300  ]",
		"[512 384  ]",
		"[640 400  ]",
		"[640 480  ]",
		"[800 500  ]",
		"[800 600  ]",
		"[960 720  ]",
		"[1024 480 ]",
		"[1024 640 ]",
		"[1024 768 ]",
		"[1152 768 ]",
		"[1152 864 ]",
		"[1280 800 ]",
		"[1280 854 ]",
		"[1280 960 ]",
		"[1280 1024]",
		"[1366 768 ]",
		"[1440 900 ]",
		"[1600 1200]",
		"[1680 1050]",
		"[1920 1080]",
		"[1920 1200]",
		"[2048 1536]",
		"[custom   ]",
		0
	};

	static const char *aspect_names[] = {
		"auto",
		"4:3",
		"5:4",
		"16:10",
		"16:9",
		"custom",
		0
	};

	static const char *uiscale_names[] = {
		"auto",
		"1x",
		"2x",
		"3x",
		"4x",
		"5x",
		"6x",
		"custom",
		0
	};

	static const char *yesno_names[] = {
		"no",
		"yes",
		0
	};

	static const char *pow2_names[] = {
		"off",
		"2x",
		"4x",
		"8x",
		"16x",
		0
	};

	if (!gl_mode)
	{
		gl_mode = Cvar_Get("gl_mode", "4", 0);
	}

	if (!gl_hudscale)
	{
		gl_hudscale = Cvar_Get("gl_hudscale", "-1", CVAR_ARCHIVE);
	}
	if (!gl_consolescale)
	{
		gl_consolescale = Cvar_Get("gl_consolescale", "-1", CVAR_ARCHIVE);
	}
	if (!gl_menuscale)
	{
		gl_menuscale = Cvar_Get("gl_menuscale", "-1", CVAR_ARCHIVE);
	}
	if (!crosshair_scale)
	{
		crosshair_scale = Cvar_Get("crosshair_scale", "-1", CVAR_ARCHIVE);
	}

	if (!horplus)
	{
		horplus = Cvar_Get("horplus", "1", CVAR_ARCHIVE);
	}

	if (!fov)
	{
		fov = Cvar_Get("fov", "90",  CVAR_USERINFO | CVAR_ARCHIVE);
	}

	if (!scr_viewsize)
	{
		scr_viewsize = Cvar_Get("viewsize", "100", CVAR_ARCHIVE);
	}

	if (!vid_gamma)
	{
		vid_gamma = Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE);
	}

	if (!gl_swapinterval)
	{
		gl_swapinterval = Cvar_Get("gl_swapinterval", "1", CVAR_ARCHIVE);
	}

	if (!gl_anisotropic)
	{
		gl_anisotropic = Cvar_Get("gl_anisotropic", "0", CVAR_ARCHIVE);
	}

	if (!gl_msaa_samples)
	{
		gl_msaa_samples = Cvar_Get("gl_msaa_samples", "0", CVAR_ARCHIVE);
	}

	s_opengl_menu.x = viddef.width * 0.50;
	s_opengl_menu.nitems = 0;

	s_mode_list.generic.type = MTYPE_SPINCONTROL;
	s_mode_list.generic.name = "video mode";
	s_mode_list.generic.x = 0;
	s_mode_list.generic.y = (y = 0);
	s_mode_list.itemnames = resolutions;
	if (gl_mode->value >= 0)
	{
		s_mode_list.curvalue = gl_mode->value;
	}
	else
	{
		s_mode_list.curvalue = GetCustomValue(&s_mode_list);
	}

	s_aspect_list.generic.type = MTYPE_SPINCONTROL;
	s_aspect_list.generic.name = "aspect ratio";
	s_aspect_list.generic.x = 0;
	s_aspect_list.generic.y = (y += 10);
	s_aspect_list.itemnames = aspect_names;
	if (horplus->value == 1)
	{
		s_aspect_list.curvalue = 0;
	}
	else if (fov->value == 90)
	{
		s_aspect_list.curvalue = 1;
	}
	else if (fov->value == 86)
	{
		s_aspect_list.curvalue = 2;
	}
	else if (fov->value == 100)
	{
		s_aspect_list.curvalue = 3;
	}
	else if (fov->value == 106)
	{
		s_aspect_list.curvalue = 4;
	}
	else
	{
		s_aspect_list.curvalue = GetCustomValue(&s_aspect_list);
	}

	s_uiscale_list.generic.type = MTYPE_SPINCONTROL;
	s_uiscale_list.generic.name = "ui scale";
	s_uiscale_list.generic.x = 0;
	s_uiscale_list.generic.y = (y += 10);
	s_uiscale_list.itemnames = uiscale_names;
	if (gl_hudscale->value != gl_consolescale->value ||
		gl_hudscale->value != gl_menuscale->value ||
		gl_hudscale->value != crosshair_scale->value)
	{
		s_uiscale_list.curvalue = GetCustomValue(&s_uiscale_list);
	}
	else if (gl_hudscale->value < 0)
	{
		s_uiscale_list.curvalue = 0;
	}
	else if (gl_hudscale->value > 0 &&
			gl_hudscale->value < GetCustomValue(&s_uiscale_list) &&
			gl_hudscale->value == (int)gl_hudscale->value)
	{
		s_uiscale_list.curvalue = gl_hudscale->value;
	}
	else
	{
		s_uiscale_list.curvalue = GetCustomValue(&s_uiscale_list);
	}

	s_screensize_slider.generic.type = MTYPE_SLIDER;
	s_screensize_slider.generic.name = "screen size";
	s_screensize_slider.generic.x = 0;
	s_screensize_slider.generic.y = (y += 10);
	s_screensize_slider.minvalue = 4;
	s_screensize_slider.maxvalue = 10;
	s_screensize_slider.generic.callback = ScreenSizeCallback;
	s_screensize_slider.curvalue = scr_viewsize->value / 10;

	s_brightness_slider.generic.type = MTYPE_SLIDER;
	s_brightness_slider.generic.name = "brightness";
	s_brightness_slider.generic.x = 0;
	s_brightness_slider.generic.y = (y += 10);
	s_brightness_slider.generic.callback = BrightnessCallback;
	s_brightness_slider.minvalue = 1;
	s_brightness_slider.maxvalue = 20;
	s_brightness_slider.curvalue = vid_gamma->value * 10;

	s_fs_box.generic.type = MTYPE_SPINCONTROL;
	s_fs_box.generic.name = "fullscreen";
	s_fs_box.generic.x = 0;
	s_fs_box.generic.y = (y += 10);
	s_fs_box.itemnames = yesno_names;
	s_fs_box.curvalue = (vid_fullscreen->value != 0);

	s_vsync_list.generic.type = MTYPE_SPINCONTROL;
	s_vsync_list.generic.name = "vertical sync";
	s_vsync_list.generic.x = 0;
	s_vsync_list.generic.y = (y += 10);
	s_vsync_list.itemnames = yesno_names;
	s_vsync_list.curvalue = (gl_swapinterval->value != 0);

	s_af_list.generic.type = MTYPE_SPINCONTROL;
	s_af_list.generic.name = "aniso filtering";
	s_af_list.generic.x = 0;
	s_af_list.generic.y = (y += 20);
	s_af_list.generic.callback = AnisotropicCallback;
	s_af_list.itemnames = pow2_names;
	s_af_list.curvalue = 0;
	if (gl_anisotropic->value)
	{
		do
		{
			s_af_list.curvalue++;
		} while (pow2_names[s_af_list.curvalue] &&
				pow(2, s_af_list.curvalue) <= gl_anisotropic->value);
		s_af_list.curvalue--;
	}

	s_msaa_list.generic.type = MTYPE_SPINCONTROL;
	s_msaa_list.generic.name = "multisampling";
	s_msaa_list.generic.x = 0;
	s_msaa_list.generic.y = (y += 10);
	s_msaa_list.itemnames = pow2_names;
	s_msaa_list.curvalue = 0;
	if (gl_msaa_samples->value)
	{
		do
		{
			s_msaa_list.curvalue++;
		} while (pow2_names[s_msaa_list.curvalue] &&
				pow(2, s_msaa_list.curvalue) <= gl_msaa_samples->value);
		s_msaa_list.curvalue--;
	}

	s_defaults_action.generic.type = MTYPE_ACTION;
	s_defaults_action.generic.name = "reset to default";
	s_defaults_action.generic.x = 0;
	s_defaults_action.generic.y = (y += 20);
	s_defaults_action.generic.callback = ResetDefaults;

	s_apply_action.generic.type = MTYPE_ACTION;
	s_apply_action.generic.name = "apply";
	s_apply_action.generic.x = 0;
	s_apply_action.generic.y = (y += 10);
	s_apply_action.generic.callback = ApplyChanges;

	Menu_AddItem(&s_opengl_menu, (void *)&s_mode_list);
	Menu_AddItem(&s_opengl_menu, (void *)&s_aspect_list);
	Menu_AddItem(&s_opengl_menu, (void *)&s_uiscale_list);
	Menu_AddItem(&s_opengl_menu, (void *)&s_screensize_slider);
	Menu_AddItem(&s_opengl_menu, (void *)&s_brightness_slider);
	Menu_AddItem(&s_opengl_menu, (void *)&s_fs_box);
	Menu_AddItem(&s_opengl_menu, (void *)&s_vsync_list);
	Menu_AddItem(&s_opengl_menu, (void *)&s_af_list);
	Menu_AddItem(&s_opengl_menu, (void *)&s_msaa_list);
	Menu_AddItem(&s_opengl_menu, (void *)&s_defaults_action);
	Menu_AddItem(&s_opengl_menu, (void *)&s_apply_action);

	Menu_Center(&s_opengl_menu);
	s_opengl_menu.x -= 8;
}
Exemplo n.º 9
0
void
VID_MenuInit(void)
{
    static const char *resolutions[] = {
        "[320 240  ]",
        "[400 300  ]",
        "[512 384  ]",
        "[640 400  ]",
        "[640 480  ]",
        "[800 500  ]",
        "[800 600  ]",
        "[960 720  ]",
        "[1024 480 ]",
        "[1024 640 ]",
        "[1024 768 ]",
        "[1152 768 ]",
        "[1152 864 ]",
        "[1280 800 ]",
        "[1280 854 ]",
        "[1280 960 ]",
        "[1280 1024]",
        "[1440 900 ]",
        "[1600 1200]",
        "[1680 1050]",
        "[1920 1080]",
        "[1920 1200]",
        "[2048 1536]",
        "[Custom   ]",
        0
    };

    static const char *yesno_names[] = {
        "no",
        "yes",
        0
    };

    static const char *aspect_names[] = {
        "Auto",
        "4:3",
        "5:4",
        "16:10",
        "16:9",
        "Custom",
        0
    };

    if (!gl_driver)
    {
        gl_driver = Cvar_Get("gl_driver", LIBGL, 0);
    }

    if (!gl_picmip)
    {
        gl_picmip = Cvar_Get("gl_picmip", "0", 0);
    }

    if (!gl_mode)
    {
        gl_mode = Cvar_Get("gl_mode", "4", 0);
    }

    if (!gl_ext_palettedtexture)
    {
        gl_ext_palettedtexture = Cvar_Get("gl_ext_palettedtexture",
                                          "0", CVAR_ARCHIVE);
    }

    if (!windowed_mouse)
    {
        windowed_mouse = Cvar_Get("windowed_mouse", "1",
                                  CVAR_USERINFO | CVAR_ARCHIVE);
    }

    if (!horplus)
    {
        horplus = Cvar_Get("horplus", "1", CVAR_ARCHIVE);
    }

    if (!fov)
    {
        fov = Cvar_Get("fov", "90",  CVAR_USERINFO | CVAR_ARCHIVE);
    }

    if (horplus->value == 1)
    {
        s_aspect_list.curvalue = 0;
    }
    else if (fov->value == 90)
    {
        s_aspect_list.curvalue = 1;
    }
    else if (fov->value == 86)
    {
        s_aspect_list.curvalue = 2;
    }
    else if (fov->value == 100)
    {
        s_aspect_list.curvalue = 3;
    }
    else if (fov->value == 106)
    {
        s_aspect_list.curvalue = 4;
    }
    else
    {
        s_aspect_list.curvalue = 5;
    }

    /* custom mode */
    if (gl_mode->value >= 0)
    {
        s_mode_list.curvalue = gl_mode->value;
    }
    else
    {
        s_mode_list.curvalue = CUSTOM_MODE;
    }

    if (!scr_viewsize)
    {
        scr_viewsize = Cvar_Get("viewsize", "100", CVAR_ARCHIVE);
    }

    if (!vid_gamma)
    {
        vid_gamma = Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE);
    }

    s_opengl_menu.x = viddef.width * 0.50;
    s_opengl_menu.nitems = 0;

    s_mode_list.generic.type = MTYPE_SPINCONTROL;
    s_mode_list.generic.name = "video mode";
    s_mode_list.generic.x = 0;
    s_mode_list.generic.y = 0;
    s_mode_list.itemnames = resolutions;

    s_aspect_list.generic.type = MTYPE_SPINCONTROL;
    s_aspect_list.generic.name = "aspect ratio";
    s_aspect_list.generic.x = 0;
    s_aspect_list.generic.y = 10;
    s_aspect_list.itemnames = aspect_names;

    s_screensize_slider.generic.type = MTYPE_SLIDER;
    s_screensize_slider.generic.x = 0;
    s_screensize_slider.generic.y = 20;
    s_screensize_slider.generic.name = "screen size";
    s_screensize_slider.minvalue = 3;
    s_screensize_slider.maxvalue = 12;
    s_screensize_slider.generic.callback = ScreenSizeCallback;
    s_screensize_slider.curvalue = scr_viewsize->value / 10;

    s_brightness_slider.generic.type = MTYPE_SLIDER;
    s_brightness_slider.generic.x = 0;
    s_brightness_slider.generic.y = 40;
    s_brightness_slider.generic.name = "brightness";
    s_brightness_slider.generic.callback = BrightnessCallback;
    s_brightness_slider.minvalue = 1;
    s_brightness_slider.maxvalue = 20;
    s_brightness_slider.curvalue = vid_gamma->value * 10;

    s_fs_box.generic.type = MTYPE_SPINCONTROL;
    s_fs_box.generic.x = 0;
    s_fs_box.generic.y = 50;
    s_fs_box.generic.name = "fullscreen";
    s_fs_box.itemnames = yesno_names;
    s_fs_box.curvalue = vid_fullscreen->value;

    s_tq_slider.generic.type = MTYPE_SLIDER;
    s_tq_slider.generic.x = 0;
    s_tq_slider.generic.y = 70;
    s_tq_slider.generic.name = "texture quality";
    s_tq_slider.minvalue = 0;
    s_tq_slider.maxvalue = 3;
    s_tq_slider.curvalue = 3 - gl_picmip->value;

    s_paletted_texture_box.generic.type = MTYPE_SPINCONTROL;
    s_paletted_texture_box.generic.x = 0;
    s_paletted_texture_box.generic.y = 80;
    s_paletted_texture_box.generic.name = "8-bit textures";
    s_paletted_texture_box.itemnames = yesno_names;
    s_paletted_texture_box.curvalue = gl_ext_palettedtexture->value;

    s_defaults_action.generic.type = MTYPE_ACTION;
    s_defaults_action.generic.name = "reset to default";
    s_defaults_action.generic.x = 0;
    s_defaults_action.generic.y = 100;
    s_defaults_action.generic.callback = ResetDefaults;

    s_apply_action.generic.type = MTYPE_ACTION;
    s_apply_action.generic.name = "apply";
    s_apply_action.generic.x = 0;
    s_apply_action.generic.y = 110;
    s_apply_action.generic.callback = ApplyChanges;

    Menu_AddItem(&s_opengl_menu, (void *)&s_mode_list);
    Menu_AddItem(&s_opengl_menu, (void *)&s_aspect_list);
    Menu_AddItem(&s_opengl_menu, (void *)&s_screensize_slider);
    Menu_AddItem(&s_opengl_menu, (void *)&s_brightness_slider);
    Menu_AddItem(&s_opengl_menu, (void *)&s_fs_box);
    Menu_AddItem(&s_opengl_menu, (void *)&s_tq_slider);
    Menu_AddItem(&s_opengl_menu, (void *)&s_paletted_texture_box);
    Menu_AddItem(&s_opengl_menu, (void *)&s_defaults_action);
    Menu_AddItem(&s_opengl_menu, (void *)&s_apply_action);

    Menu_Center(&s_opengl_menu);
    s_opengl_menu.x -= 8;
}
Exemplo n.º 10
0
void DMOptions_MenuInit( void )
{
	static const char *yes_no_names[] =
	{
		"no", "yes", 0
	};
	static const char *teamplay_names[] = 
	{
		"disabled", "by skin", "by model", 0
	};
	int dmflags = Cvar_VariableIntValue( "dmflags" );
	int y = 0;

	memset(&s_dmoptions_menu, 0, sizeof(s_dmoptions_menu));
	s_dmoptions_menu.x = viddef.width * 0.50;
	s_dmoptions_menu.nitems = 0;

	s_falls_box.generic.type = MTYPE_SPINCONTROL;
	s_falls_box.generic.x	= 0;
	s_falls_box.generic.y	= y;
	s_falls_box.generic.name	= "falling damage";
	s_falls_box.generic.callback = DMFlagCallback;
	s_falls_box.itemnames = yes_no_names;
	s_falls_box.curvalue = ( dmflags & DF_NO_FALLING ) == 0;

	s_weapons_stay_box.generic.type = MTYPE_SPINCONTROL;
	s_weapons_stay_box.generic.x	= 0;
	s_weapons_stay_box.generic.y	= y += 10;
	s_weapons_stay_box.generic.name	= "weapons stay";
	s_weapons_stay_box.generic.callback = DMFlagCallback;
	s_weapons_stay_box.itemnames = yes_no_names;
	s_weapons_stay_box.curvalue = ( dmflags & DF_WEAPONS_STAY ) != 0;

	s_instant_powerups_box.generic.type = MTYPE_SPINCONTROL;
	s_instant_powerups_box.generic.x	= 0;
	s_instant_powerups_box.generic.y	= y += 10;
	s_instant_powerups_box.generic.name	= "instant powerups";
	s_instant_powerups_box.generic.callback = DMFlagCallback;
	s_instant_powerups_box.itemnames = yes_no_names;
	s_instant_powerups_box.curvalue = ( dmflags & DF_INSTANT_ITEMS ) != 0;

	s_powerups_box.generic.type = MTYPE_SPINCONTROL;
	s_powerups_box.generic.x	= 0;
	s_powerups_box.generic.y	= y += 10;
	s_powerups_box.generic.name	= "allow powerups";
	s_powerups_box.generic.callback = DMFlagCallback;
	s_powerups_box.itemnames = yes_no_names;
	s_powerups_box.curvalue = ( dmflags & DF_NO_ITEMS ) == 0;

	s_health_box.generic.type = MTYPE_SPINCONTROL;
	s_health_box.generic.x	= 0;
	s_health_box.generic.y	= y += 10;
	s_health_box.generic.callback = DMFlagCallback;
	s_health_box.generic.name	= "allow health";
	s_health_box.itemnames = yes_no_names;
	s_health_box.curvalue = ( dmflags & DF_NO_HEALTH ) == 0;

	s_armor_box.generic.type = MTYPE_SPINCONTROL;
	s_armor_box.generic.x	= 0;
	s_armor_box.generic.y	= y += 10;
	s_armor_box.generic.name	= "allow armor";
	s_armor_box.generic.callback = DMFlagCallback;
	s_armor_box.itemnames = yes_no_names;
	s_armor_box.curvalue = ( dmflags & DF_NO_ARMOR ) == 0;

	s_spawn_farthest_box.generic.type = MTYPE_SPINCONTROL;
	s_spawn_farthest_box.generic.x	= 0;
	s_spawn_farthest_box.generic.y	= y += 10;
	s_spawn_farthest_box.generic.name	= "spawn farthest";
	s_spawn_farthest_box.generic.callback = DMFlagCallback;
	s_spawn_farthest_box.itemnames = yes_no_names;
	s_spawn_farthest_box.curvalue = ( dmflags & DF_SPAWN_FARTHEST ) != 0;

	s_samelevel_box.generic.type = MTYPE_SPINCONTROL;
	s_samelevel_box.generic.x	= 0;
	s_samelevel_box.generic.y	= y += 10;
	s_samelevel_box.generic.name	= "same map";
	s_samelevel_box.generic.callback = DMFlagCallback;
	s_samelevel_box.itemnames = yes_no_names;
	s_samelevel_box.curvalue = ( dmflags & DF_SAME_LEVEL ) != 0;

	s_force_respawn_box.generic.type = MTYPE_SPINCONTROL;
	s_force_respawn_box.generic.x	= 0;
	s_force_respawn_box.generic.y	= y += 10;
	s_force_respawn_box.generic.name	= "force respawn";
	s_force_respawn_box.generic.callback = DMFlagCallback;
	s_force_respawn_box.itemnames = yes_no_names;
	s_force_respawn_box.curvalue = ( dmflags & DF_FORCE_RESPAWN ) != 0;

	s_teamplay_box.generic.type = MTYPE_SPINCONTROL;
	s_teamplay_box.generic.x	= 0;
	s_teamplay_box.generic.y	= y += 10;
	s_teamplay_box.generic.name	= "teamplay";
	s_teamplay_box.generic.callback = DMFlagCallback;
	s_teamplay_box.itemnames = teamplay_names;

	s_allow_exit_box.generic.type = MTYPE_SPINCONTROL;
	s_allow_exit_box.generic.x	= 0;
	s_allow_exit_box.generic.y	= y += 10;
	s_allow_exit_box.generic.name	= "allow exit";
	s_allow_exit_box.generic.callback = DMFlagCallback;
	s_allow_exit_box.itemnames = yes_no_names;
	s_allow_exit_box.curvalue = ( dmflags & DF_ALLOW_EXIT ) != 0;

	s_infinite_ammo_box.generic.type = MTYPE_SPINCONTROL;
	s_infinite_ammo_box.generic.x	= 0;
	s_infinite_ammo_box.generic.y	= y += 10;
	s_infinite_ammo_box.generic.name	= "infinite ammo";
	s_infinite_ammo_box.generic.callback = DMFlagCallback;
	s_infinite_ammo_box.itemnames = yes_no_names;
	s_infinite_ammo_box.curvalue = ( dmflags & DF_INFINITE_AMMO ) != 0;

	s_fixed_fov_box.generic.type = MTYPE_SPINCONTROL;
	s_fixed_fov_box.generic.x	= 0;
	s_fixed_fov_box.generic.y	= y += 10;
	s_fixed_fov_box.generic.name	= "fixed FOV";
	s_fixed_fov_box.generic.callback = DMFlagCallback;
	s_fixed_fov_box.itemnames = yes_no_names;
	s_fixed_fov_box.curvalue = ( dmflags & DF_FIXED_FOV ) != 0;

	s_quad_drop_box.generic.type = MTYPE_SPINCONTROL;
	s_quad_drop_box.generic.x	= 0;
	s_quad_drop_box.generic.y	= y += 10;
	s_quad_drop_box.generic.name	= "quad drop";
	s_quad_drop_box.generic.callback = DMFlagCallback;
	s_quad_drop_box.itemnames = yes_no_names;
	s_quad_drop_box.curvalue = ( dmflags & DF_QUAD_DROP ) != 0;

	s_friendlyfire_box.generic.type = MTYPE_SPINCONTROL;
	s_friendlyfire_box.generic.x	= 0;
	s_friendlyfire_box.generic.y	= y += 10;
	s_friendlyfire_box.generic.name	= "friendly fire";
	s_friendlyfire_box.generic.callback = DMFlagCallback;
	s_friendlyfire_box.itemnames = yes_no_names;
	s_friendlyfire_box.curvalue = ( dmflags & DF_NO_FRIENDLY_FIRE ) == 0;

//============
//ROGUE
	if(Developer_searchpath() == 2)
	{
		s_no_mines_box.generic.type = MTYPE_SPINCONTROL;
		s_no_mines_box.generic.x	= 0;
		s_no_mines_box.generic.y	= y += 10;
		s_no_mines_box.generic.name	= "remove mines";
		s_no_mines_box.generic.callback = DMFlagCallback;
		s_no_mines_box.itemnames = yes_no_names;
		s_no_mines_box.curvalue = ( dmflags & DF_NO_MINES ) != 0;

		s_no_nukes_box.generic.type = MTYPE_SPINCONTROL;
		s_no_nukes_box.generic.x	= 0;
		s_no_nukes_box.generic.y	= y += 10;
		s_no_nukes_box.generic.name	= "remove nukes";
		s_no_nukes_box.generic.callback = DMFlagCallback;
		s_no_nukes_box.itemnames = yes_no_names;
		s_no_nukes_box.curvalue = ( dmflags & DF_NO_NUKES ) != 0;

		s_stack_double_box.generic.type = MTYPE_SPINCONTROL;
		s_stack_double_box.generic.x	= 0;
		s_stack_double_box.generic.y	= y += 10;
		s_stack_double_box.generic.name	= "2x/4x stacking off";
		s_stack_double_box.generic.callback = DMFlagCallback;
		s_stack_double_box.itemnames = yes_no_names;
		s_stack_double_box.curvalue = ( dmflags & DF_NO_STACK_DOUBLE ) != 0;

		s_no_spheres_box.generic.type = MTYPE_SPINCONTROL;
		s_no_spheres_box.generic.x	= 0;
		s_no_spheres_box.generic.y	= y += 10;
		s_no_spheres_box.generic.name	= "remove spheres";
		s_no_spheres_box.generic.callback = DMFlagCallback;
		s_no_spheres_box.itemnames = yes_no_names;
		s_no_spheres_box.curvalue = ( dmflags & DF_NO_SPHERES ) != 0;

	}
//ROGUE
//============

	s_dmoptions_menu.draw = NULL;
	s_dmoptions_menu.key = NULL;

	Menu_AddItem( &s_dmoptions_menu, &s_falls_box );
	Menu_AddItem( &s_dmoptions_menu, &s_weapons_stay_box );
	Menu_AddItem( &s_dmoptions_menu, &s_instant_powerups_box );
	Menu_AddItem( &s_dmoptions_menu, &s_powerups_box );
	Menu_AddItem( &s_dmoptions_menu, &s_health_box );
	Menu_AddItem( &s_dmoptions_menu, &s_armor_box );
	Menu_AddItem( &s_dmoptions_menu, &s_spawn_farthest_box );
	Menu_AddItem( &s_dmoptions_menu, &s_samelevel_box );
	Menu_AddItem( &s_dmoptions_menu, &s_force_respawn_box );
	Menu_AddItem( &s_dmoptions_menu, &s_teamplay_box );
	Menu_AddItem( &s_dmoptions_menu, &s_allow_exit_box );
	Menu_AddItem( &s_dmoptions_menu, &s_infinite_ammo_box );
	Menu_AddItem( &s_dmoptions_menu, &s_fixed_fov_box );
	Menu_AddItem( &s_dmoptions_menu, &s_quad_drop_box );
	Menu_AddItem( &s_dmoptions_menu, &s_friendlyfire_box );

//=======
//ROGUE
	if(Developer_searchpath() == 2)
	{
		Menu_AddItem( &s_dmoptions_menu, &s_no_mines_box );
		Menu_AddItem( &s_dmoptions_menu, &s_no_nukes_box );
		Menu_AddItem( &s_dmoptions_menu, &s_stack_double_box );
		Menu_AddItem( &s_dmoptions_menu, &s_no_spheres_box );
	}
//ROGUE
//=======

	Menu_Center( &s_dmoptions_menu );

	// set the original dmflags statusbar
	DMFlagCallback( 0 );
	Menu_SetStatusBar( &s_dmoptions_menu, dmoptions_statusbar );
}
Exemplo n.º 11
0
//=================
//TeamConfig_MenuInit
//=================
static qboolean TeamConfig_MenuInit( void )
{
	menucommon_t *menuitem;
	m_listitem_t *item;
	playermodelinfo_s *playermodel;
	int yoffset = 0;

	static char *team_names[] =
	{
		"PLAYERS",
		"ALPHA",
		"BETA",
		0
	};

	if( playermodelsItemsList.numItems == 0 )
		return qfalse;

	s_team_config_menu.nitems = 0;

	currentTEAM = TEAM_ALPHA;
	UpdateTeamCvars();

	// title
	menuitem = UI_InitMenuItem( "m_TeamConfig_title1", "TEAM ASPECT SETUP", 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL );
	Menu_AddItem( &s_team_config_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );

	yoffset += trap_SCR_strHeight( menuitem->font );

	// team
	menuitem = UI_InitMenuItem( "m_TeamConfig_team", "team", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, ChangeTeamCallback );
	UI_SetupSpinControl( menuitem, team_names, TEAM_ALPHA - TEAM_PLAYERS );
	Menu_AddItem( &s_team_config_menu, menuitem );

	yoffset += trap_SCR_strHeight( menuitem->font );

	// padding
	yoffset += trap_SCR_strHeight( menuitem->font );

	// model
	menuitem = UI_InitMenuItem( "m_TeamConfig_forcemodel", "force a team model", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ApplyChanges );
	UI_SetupSpinControl( menuitem, noyes_names, ( model->string[0] != 0 ) );
	Menu_AddItem( &s_team_config_menu, menuitem );
	hasForcedModelMenuItem = menuitem;

	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_TeamConfig_model", "model", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, TeamModelCallback );
	UI_SetupSpinControl( menuitem, playermodelsItemsList.item_names, 0 );
	Menu_AddItem( &s_team_config_menu, menuitem );

	yoffset += trap_SCR_strHeight( menuitem->font );

	item = UI_FindItemInScrollListWithId( &playermodelsItemsList, 0 );
	playermodel = (playermodelinfo_s *)item->data;
	menuitem = UI_InitMenuItem( "m_TeamConfig_skin", "skin", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ApplyChanges );
	UI_SetupSpinControl( menuitem, playermodel->skinnames, 0 );
	Menu_AddItem( &s_team_config_menu, menuitem );

	yoffset += trap_SCR_strHeight( menuitem->font );

	M_GetTeamModel();

	// padding
	yoffset += trap_SCR_strHeight( menuitem->font );

	// color
	menuitem = UI_InitMenuItem( "m_TeamConfig_forcecolor", "force a team color", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, ForceAColorCallback );
	UI_SetupSpinControl( menuitem, noyes_names, ( color->string[0] != 0 ) );
	Menu_AddItem( &s_team_config_menu, menuitem );
	hasForcedColorMenuItem = menuitem;

	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_TeamConfig_colorred", "red", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ColorRedCallback );
	Menu_AddItem( &s_team_config_menu, menuitem );
	UI_SetupSlider( menuitem, 12, playerColor[0], 0, 255 );

	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_TeamConfig_colorgreen", "green", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ColorGreenCallback );
	Menu_AddItem( &s_team_config_menu, menuitem );
	UI_SetupSlider( menuitem, 12, playerColor[1], 0, 255 );

	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_TeamConfig_colorblue", "blue", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_ColorBlueCallback );
	Menu_AddItem( &s_team_config_menu, menuitem );
	UI_SetupSlider( menuitem, 12, playerColor[2], 0, 255 );

	M_GetTeamColor();

	yoffset += trap_SCR_strHeight( menuitem->font );

	// padding
	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_TeamConfig_MyTeamAlpha", "switch my team to show as team ALPHA", 60, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_MyTeamAlpha );
	UI_SetupSpinControl( menuitem, noyes_names, ( trap_Cvar_Value( "cg_forceMyTeamAlpha" ) ) );
	Menu_AddItem( &s_team_config_menu, menuitem );

	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_TeamConfig_TeamPlayersTeamBeta", "show teamless players as team BETA players", 60, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_TeamConfig_TeamPlayersTeamBeta );
	UI_SetupSpinControl( menuitem, noyes_names, ( trap_Cvar_Value( "cg_forceTeamPlayersTeamBeta" ) ) );
	Menu_AddItem( &s_team_config_menu, menuitem );

	yoffset += trap_SCR_strHeight( menuitem->font );

	// padding
	yoffset += trap_SCR_strHeight( menuitem->font );

	// help
	menuitem = UI_InitMenuItem( "m_TeamConfig_HelpText", "If you want to always force your teammates and your enemies to a specific look,", 10, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemSmall, NULL );
	Menu_AddItem( &s_team_config_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_TeamConfig_HelpText2", "set both of the above options and configure ALPHA and BETA teams", 10, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemSmall, NULL );
	Menu_AddItem( &s_team_config_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );

	// padding
	yoffset += trap_SCR_strHeight( menuitem->font );

	// back
	menuitem = UI_InitMenuItem( "m_TeamConfig_back", "back", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_TeamConfig_SaveAndClose );
	Menu_AddItem( &s_team_config_menu, menuitem );
	UI_SetupButton( menuitem, qtrue );

	Menu_Center( &s_team_config_menu );
	Menu_Init( &s_team_config_menu, qfalse );

	return qtrue;
}
Exemplo n.º 12
0
/*
** VID_MenuInit
*/
void VID_MenuInit( void )
{
    static const char *resolutions[] =
    {
        "[320 240  ]",
        "[400 300  ]",
        "[512 384  ]",
        "[640 480  ]",
        "[800 600  ]",
        "[960 720  ]",
        "[1024 768 ]",
        "[1152 864 ]",
        "[1280 960 ]",
        "[1600 1200]",
        "[2048 1536]",
        "[1024 480 ]",
        "[1280 768 ]",
        "[1280 1024]",
        "[Custom   ]",
        0
    };
    static const char *refs[] =
    {
#ifdef _WIN32
        "[default OpenGL]",
        "[3Dfx OpenGL   ]",
        "[PowerVR OpenGL]",
#else
        "[OpenGL glX     ]",
        "[Mesa 3-D glX   ]",
#endif
        0
    };
    static const char *yesno_names[] =
    {
        "no",
        "yes",
        0
    };

    s_screensize_slider.curvalue = scr_viewsize->integer/10;

#ifndef GL_QUAKE
    if(sw_mode->integer == -1)
        s_mode_list.curvalue = RMODES;
    else
        s_mode_list.curvalue = sw_mode->integer;
#else
    if(gl_mode->integer == -1)
        s_mode_list.curvalue = RMODES;
    else
        s_mode_list.curvalue = gl_mode->integer;

# ifdef _WIN32
    if ( strcmp( gl_driver->string, "3dfxgl" ) == 0 )
        s_ref_list.curvalue = REF_3DFX;
    else if ( strcmp( gl_driver->string, "pvrgl" ) == 0 )
        s_ref_list.curvalue = REF_POWERVR;
    else
        s_ref_list.curvalue = REF_OPENGL;
# else
    if ( strcmp( gl_driver->string, "libMesaGL.so.2" ) == 0 )
        s_ref_list.curvalue = REF_MESA3DGLX;
    else
        s_ref_list.curvalue = REF_OPENGLX;
# endif
#endif

    memset(&s_video_menu, 0, sizeof(s_video_menu));
    s_video_menu.x = viddef.width * 0.50;
    s_video_menu.nitems = 0;

    s_ref_list.generic.type = MTYPE_SPINCONTROL;
    s_ref_list.generic.name = "driver";
    s_ref_list.generic.x = 0;
    s_ref_list.generic.y = 0;
    s_ref_list.generic.callback = NULL;
    s_ref_list.itemnames = refs;

    s_mode_list.generic.type = MTYPE_SPINCONTROL;
    s_mode_list.generic.name = "video mode";
    s_mode_list.generic.x = 0;
    s_mode_list.generic.y = 10;
    s_mode_list.itemnames = resolutions;

    s_screensize_slider.generic.type	= MTYPE_SLIDER;
    s_screensize_slider.generic.x		= 0;
    s_screensize_slider.generic.y		= 20;
    s_screensize_slider.generic.name	= "screen size";
    s_screensize_slider.minvalue = 4;
    s_screensize_slider.maxvalue = 10;
    s_screensize_slider.generic.callback = ScreenSizeCallback;

    s_brightness_slider.generic.type	= MTYPE_SLIDER;
    s_brightness_slider.generic.x	= 0;
    s_brightness_slider.generic.y	= 30;
    s_brightness_slider.generic.name	= "brightness";
    s_brightness_slider.generic.callback = BrightnessCallback;
    s_brightness_slider.minvalue = 5;
    s_brightness_slider.maxvalue = 13;
    s_brightness_slider.curvalue = ( 1.3 - vid_gamma->value + 0.5 ) * 10;

    s_fs_box.generic.type = MTYPE_SPINCONTROL;
    s_fs_box.generic.x	= 0;
    s_fs_box.generic.y	= 40;
    s_fs_box.generic.name	= "fullscreen";
    s_fs_box.itemnames = yesno_names;
    s_fs_box.curvalue = vid_fullscreen->integer;

    s_defaults_action.generic.type = MTYPE_ACTION;
    s_defaults_action.generic.name = "reset to defaults";
    s_defaults_action.generic.x    = 0;
    s_defaults_action.generic.y    = 90;
    s_defaults_action.generic.callback = ResetDefaults;

    s_apply_action.generic.type = MTYPE_ACTION;
    s_apply_action.generic.name = "apply";
    s_apply_action.generic.x    = 0;
    s_apply_action.generic.y    = 100;
    s_apply_action.generic.callback = ApplyChanges;

#ifndef GL_QUAKE
    s_stipple_box.generic.type = MTYPE_SPINCONTROL;
    s_stipple_box.generic.x	= 0;
    s_stipple_box.generic.y	= 60;
    s_stipple_box.generic.name	= "stipple alpha";
    s_stipple_box.curvalue = sw_stipplealpha->value;
    s_stipple_box.itemnames = yesno_names;
#else
    s_tq_slider.generic.type	= MTYPE_SLIDER;
    s_tq_slider.generic.x		= 0;
    s_tq_slider.generic.y		= 60;
    s_tq_slider.generic.name	= "texture quality";
    s_tq_slider.minvalue = 0;
    s_tq_slider.maxvalue = 3;
    s_tq_slider.curvalue = 3-gl_picmip->integer;

    s_finish_box.generic.type = MTYPE_SPINCONTROL;
    s_finish_box.generic.x	= 0;
    s_finish_box.generic.y	= 80;
    s_finish_box.generic.name	= "sync every frame";
    s_finish_box.curvalue = gl_finish->integer;
    s_finish_box.itemnames = yesno_names;
#endif
    s_video_menu.draw = VID_MenuDraw;
    s_video_menu.key = NULL;

#ifndef GL_QUAKE
    Menu_AddItem( &s_video_menu, ( void * ) &s_mode_list );
    Menu_AddItem( &s_video_menu, ( void * ) &s_screensize_slider );
    Menu_AddItem( &s_video_menu, ( void * ) &s_brightness_slider );
    Menu_AddItem( &s_video_menu, ( void * ) &s_fs_box );
    Menu_AddItem( &s_video_menu, ( void * ) &s_stipple_box );
#else
    Menu_AddItem( &s_video_menu, ( void * ) &s_ref_list );
    Menu_AddItem( &s_video_menu, ( void * ) &s_mode_list );
    Menu_AddItem( &s_video_menu, ( void * ) &s_screensize_slider );
    Menu_AddItem( &s_video_menu, ( void * ) &s_brightness_slider );
    Menu_AddItem( &s_video_menu, ( void * ) &s_fs_box );
    Menu_AddItem( &s_video_menu, ( void * ) &s_tq_slider );
    Menu_AddItem( &s_video_menu, ( void * ) &s_finish_box );
#endif

    Menu_AddItem( &s_video_menu, ( void * ) &s_defaults_action );
    Menu_AddItem( &s_video_menu, ( void * ) &s_apply_action );

    Menu_Center( &s_video_menu );
    s_video_menu.x -= 8;
}
Exemplo n.º 13
0
void DownloadOptions_MenuInit( void )
{
	static const char *yes_no_names[] =
	{
		"no", "yes", 0
	};
	int y = 0;

	memset(&s_downloadoptions_menu, 0, sizeof(s_downloadoptions_menu));
	s_downloadoptions_menu.x = viddef.width * 0.50;
	s_downloadoptions_menu.nitems = 0;

	s_download_title.generic.type = MTYPE_SEPARATOR;
	s_download_title.generic.name = "Download Options";
	s_download_title.generic.x    = 48;
	s_download_title.generic.y	 = y;

	s_allow_download_box.generic.type = MTYPE_SPINCONTROL;
	s_allow_download_box.generic.x	= 0;
	s_allow_download_box.generic.y	= y += 20;
	s_allow_download_box.generic.name	= "allow downloading";
	s_allow_download_box.generic.callback = DownloadCallback;
	s_allow_download_box.itemnames = yes_no_names;
	s_allow_download_box.curvalue = (Cvar_VariableIntValue("allow_download") != 0);

	s_allow_download_maps_box.generic.type = MTYPE_SPINCONTROL;
	s_allow_download_maps_box.generic.x	= 0;
	s_allow_download_maps_box.generic.y	= y += 20;
	s_allow_download_maps_box.generic.name	= "maps";
	s_allow_download_maps_box.generic.callback = DownloadCallback;
	s_allow_download_maps_box.itemnames = yes_no_names;
	s_allow_download_maps_box.curvalue = (Cvar_VariableIntValue("allow_download_maps") != 0);

	s_allow_download_players_box.generic.type = MTYPE_SPINCONTROL;
	s_allow_download_players_box.generic.x	= 0;
	s_allow_download_players_box.generic.y	= y += 10;
	s_allow_download_players_box.generic.name	= "player models/skins";
	s_allow_download_players_box.generic.callback = DownloadCallback;
	s_allow_download_players_box.itemnames = yes_no_names;
	s_allow_download_players_box.curvalue = (Cvar_VariableIntValue("allow_download_players") != 0);

	s_allow_download_models_box.generic.type = MTYPE_SPINCONTROL;
	s_allow_download_models_box.generic.x	= 0;
	s_allow_download_models_box.generic.y	= y += 10;
	s_allow_download_models_box.generic.name	= "models";
	s_allow_download_models_box.generic.callback = DownloadCallback;
	s_allow_download_models_box.itemnames = yes_no_names;
	s_allow_download_models_box.curvalue = (Cvar_VariableIntValue("allow_download_models") != 0);

	s_allow_download_sounds_box.generic.type = MTYPE_SPINCONTROL;
	s_allow_download_sounds_box.generic.x	= 0;
	s_allow_download_sounds_box.generic.y	= y += 10;
	s_allow_download_sounds_box.generic.name	= "sounds";
	s_allow_download_sounds_box.generic.callback = DownloadCallback;
	s_allow_download_sounds_box.itemnames = yes_no_names;
	s_allow_download_sounds_box.curvalue = (Cvar_VariableIntValue("allow_download_sounds") != 0);

	s_downloadoptions_menu.draw = NULL;
	s_downloadoptions_menu.key = NULL;

	Menu_AddItem( &s_downloadoptions_menu, &s_download_title );
	Menu_AddItem( &s_downloadoptions_menu, &s_allow_download_box );
	Menu_AddItem( &s_downloadoptions_menu, &s_allow_download_maps_box );
	Menu_AddItem( &s_downloadoptions_menu, &s_allow_download_players_box );
	Menu_AddItem( &s_downloadoptions_menu, &s_allow_download_models_box );
	Menu_AddItem( &s_downloadoptions_menu, &s_allow_download_sounds_box );

	Menu_Center( &s_downloadoptions_menu );

	// skip over title
	if (s_downloadoptions_menu.cursor == 0)
		s_downloadoptions_menu.cursor = 1;
}
Exemplo n.º 14
0
static void M_TV_Init( void )
{
	int i, yoffset, xoffset, vspacing;
	static char titlename[64];
	menucommon_t *menuitem;
	int scrollwindow_height, scrollwindow_width, scrollbar_id;

	yoffset = 0;
	xoffset = 0;

	s_tv_menu.nitems = 0;

	Q_snprintfz( titlename, sizeof( titlename ), "%s TV", trap_Cvar_String( "gamename" ) );

	menuitem = UI_InitMenuItem( "m_tv_title1", titlename, 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL );
	Menu_AddItem( &s_tv_menu, menuitem );
	yoffset += 2 *trap_SCR_strHeight( menuitem->font );

	// scrollbar
	if( uis.vidWidth < 800 )
		scrollwindow_width = uis.vidWidth * 0.85;
	else
		scrollwindow_width = uis.vidWidth * 0.75;

	xoffset = scrollwindow_width / 2;

	vspacing = trap_SCR_strHeight( uis.fontSystemSmall ) + 4;
	scrollwindow_height = uis.vidHeight - ( yoffset + ( 16 * trap_SCR_strHeight( uis.fontSystemBig ) ) );
	max_menu_channels = scrollwindow_height / vspacing;
	if( max_menu_channels < 5 )
		max_menu_channels = 5;

	menuitem = UI_InitMenuItem( "m_tv_titlerow", NULL, -xoffset, yoffset, MTYPE_SEPARATOR, ALIGN_LEFT_TOP, uis.fontSystemSmall, NULL );
	Q_snprintfz( menuitem->title, MAX_STRING_CHARS, 
			ROW_PATTERN,
			COLUMN_WIDTH_NO, "No", 
			COLUMN_WIDTH_NAME, "", "Server",
			COLUMN_WIDTH_PLAYERS, "", " Pl/Sp",
			COLUMN_WIDTH_GAMETYPE, "", "Gametype",
			COLUMN_WIDTH_MAPNAME, "", "Map",
			COLUMN_WIDTH_MATCHNAME, "", "Match"
	);
	Menu_AddItem( &s_tv_menu, menuitem );
	yoffset += trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_tv_scrollbar", NULL, xoffset, yoffset, MTYPE_SCROLLBAR, ALIGN_LEFT_TOP, uis.fontSystemSmall, M_TV_UpdateScrollbar );
	menuitem->vspacing = vspacing;
	menuitem->scrollbar_id = scrollbar_id = s_tv_menu.nitems; //give the scrollbar an id to pass onto its list
	Q_strncpyz( menuitem->title, va( "ui_tv_scrollbar%i_curvalue", scrollbar_id ), sizeof( menuitem->title ) );
	if( !trap_Cvar_Value( menuitem->title ) )
		trap_Cvar_SetValue( menuitem->title, 0 );
	UI_SetupScrollbar( menuitem, max_menu_channels, trap_Cvar_Value( menuitem->title ), 0, 0 );
	Menu_AddItem( &s_tv_menu, menuitem );

	for( i = 0; i < max_menu_channels; i++ )
	{
		menuitem = UI_InitMenuItem( va( "m_tv_button_%i", i ), NO_CHANNEL_STRING, -xoffset, yoffset, MTYPE_ACTION,
		                            ALIGN_LEFT_TOP, uis.fontSystemSmall, NULL );
		menuitem->callback_doubleclick = M_TV_JoinChannel;
		menuitem->scrollbar_id = scrollbar_id; //id of the scrollbar so that mwheelup/down can scroll from the list
		menuitem->height = vspacing;
		menuitem->statusbar = "press ENTER to watch";
		menuitem->ownerdraw = M_UpdateChannelButton;
		menuitem->localdata[0] = i; // line in the window
		menuitem->localdata[1] = i; // line in list
		menuitem->width = scrollwindow_width; // adjust strings to this width
		Menu_AddItem( &s_tv_menu, menuitem );

		// create an associated picture to the items to act as window background
		menuitem->pict.shader = uis.whiteShader;
		menuitem->pict.shaderHigh = uis.whiteShader;
		Vector4Copy( colorWhite, menuitem->pict.colorHigh );
		Vector4Copy( ( i & 1 ) ? colorDkGrey : colorMdGrey, menuitem->pict.color );
		menuitem->pict.color[3] = menuitem->pict.colorHigh[3] = 0.65f;
		menuitem->pict.yoffset = 0;
		menuitem->pict.xoffset = 0;
		menuitem->pict.width = scrollwindow_width;
		menuitem->pict.height = vspacing;

		yoffset += vspacing;
	}

	yoffset += 1.5 * trap_SCR_strHeight( menuitem->font );

	menuitem = UI_InitMenuItem( "m_tv_refresh", "refresh", -xoffset, yoffset, MTYPE_ACTION, ALIGN_LEFT_TOP, uis.fontSystemBig, M_TV_RefreshFunc );
	Menu_AddItem( &s_tv_menu, menuitem );
	UI_SetupButton( menuitem, qtrue );

	menuitem = UI_InitMenuItem( "m_tv_disconnect", "watch", xoffset, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_TV_JoinChannel );
	Menu_AddItem( &s_tv_menu, menuitem );
	UI_SetupButton( menuitem, qtrue );
	xoffset -= ( menuitem->width + 16 );

	menuitem = UI_InitMenuItem( "m_tv_setup", "main menu", xoffset, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_TV_MenuMainFunc );
	Menu_AddItem( &s_tv_menu, menuitem );
	UI_SetupButton( menuitem, qtrue );
	xoffset -= ( menuitem->width + 16 );

	if( uis.clientState >= CA_ACTIVE )
	{
		menuitem = UI_InitMenuItem( "m_tv_chasecam", "chasecam", xoffset, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_TV_SpecModeMenuFunc );
		Menu_AddItem( &s_tv_menu, menuitem );
		UI_SetupButton( menuitem, qtrue );
		xoffset -= ( menuitem->width + 16 );
	}

	Menu_Center( &s_tv_menu );
	Menu_Init( &s_tv_menu, qfalse );

	Menu_SetStatusBar( &s_tv_menu, NULL );
}
Exemplo n.º 15
0
/*
** VID_MenuInit
*/
void VID_MenuInit( void )
{
	int i;

	static const char *resolutions[] = 
	{
		// jkrige - video resolutions
		"[320 240  ]",
		"[640 480  ]",
		"[1024 768 ]",
		"[1280 720 ]",
		"[1366 768 ]",
		"[1600 900 ]",
		"[1440 900 ]",
		"[1680 1050]",
		"[1920 1080]",
		"[2560 1440]",
		0

		/*"[320 240  ]",
		"[640 480  ]",
		"[800 600  ]",
		"[1024 768 ]",
		"[1152 864 ]",
		"[1280 720 ]",
		"[1280 960 ]",
		"[1600 900 ]",
		"[1600 1200]",
		"[1920 1080]",
		0*/
		// jkrige - video resolutions
	};

	static const char *yesno_names[] =
	{
		"no",
		"yes",
		0
	};

	static const char *texturemode_names[] =
	{
		"point",
		"bilinear",
		"trilinear",
		"anisotropic 2x",
		"anisotropic 4x",
		"anisotropic 8x",
		"anisotropic 16x",
		0
	};

	if ( !gl_driver )
		gl_driver = Cvar_Get( "gl_driver", "opengl32", 0 );

	// jkrige - texture quality
	//if ( !gl_picmip )
	//	gl_picmip = Cvar_Get( "gl_picmip", "0", 0 );
	// jkrige - texture quality

	// jkrige - video resolutions
	if ( !gl_mode )
	{
		gl_mode = Cvar_Get( "gl_mode", "2", 0 );
		//gl_mode = Cvar_Get( "gl_mode", "3", 0 );
	}
	// jkrige - video resolutions


	// jkrige - palette removal
	//if ( !gl_ext_palettedtexture )
	//	gl_ext_palettedtexture = Cvar_Get( "gl_ext_palettedtexture", "1", CVAR_ARCHIVE );
	// jkrige - palette removal

	if ( !gl_finish )
		gl_finish = Cvar_Get( "gl_finish", "0", CVAR_ARCHIVE );

	s_mode_list.curvalue = gl_mode->value;

	// jkrige - viewsize removal
	//if ( !scr_viewsize )
	//	scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE);
	//s_screensize_slider.curvalue = scr_viewsize->value / 10;
	// jkrige - viewsize removal

	s_opengl_menu.x = viddef.width * 0.50;
	s_opengl_menu.nitems = 0;
	

	s_mode_list.generic.type = MTYPE_SPINCONTROL;
	s_mode_list.generic.name = "video mode";
	s_mode_list.generic.x = 0;
	s_mode_list.generic.y = 0;
	s_mode_list.itemnames = resolutions;

	// jkrige - viewsize removal
	/*s_screensize_slider.generic.type	= MTYPE_SLIDER;
	s_screensize_slider.generic.x = 0;
	// jkrige - scale2d
	s_screensize_slider.generic.y = 10*VID_SCALEFACTOR;
	//s_screensize_slider.generic.y = 10;
	// jkrige - scale2d
	s_screensize_slider.generic.name = "screen size";
	s_screensize_slider.minvalue = 3;
	s_screensize_slider.maxvalue = 12;
	s_screensize_slider.generic.callback = ScreenSizeCallback;*/
	// jkrige - viewsize removal

	s_brightness_slider.generic.type	= MTYPE_SLIDER;
	s_brightness_slider.generic.x = 0;
	// jkrige - scale2d
	s_brightness_slider.generic.y = 20*VID_SCALEFACTOR;
	//s_brightness_slider.generic.y = 20;
	// jkrige - scale2d
	s_brightness_slider.generic.name = "brightness";
	s_brightness_slider.generic.callback = BrightnessCallback;
	// jkrige - gamma
	//s_brightness_slider.minvalue = 5;
	//s_brightness_slider.maxvalue = 13;
	//s_brightness_slider.curvalue = (1.3 - vid_gamma->value + 0.5) * 10;
	s_brightness_slider.minvalue = 10;
	s_brightness_slider.maxvalue = 27;
	s_brightness_slider.curvalue = (2.7 - vid_gamma->value + 1.0) * 10;
	// jkrige - gamma


	// jkrige - anisotropic filtering
	s_texturemode_box.generic.type = MTYPE_SPINCONTROL;
	s_texturemode_box.generic.x = 0;
	s_texturemode_box.generic.y = 30*VID_SCALEFACTOR;
	s_texturemode_box.generic.name = "texture mode";
	s_texturemode_box.generic.callback = TextureModeCallback;
	s_texturemode_box.curvalue = Cvar_VariableValue( "gl_texturemode" );
	s_texturemode_box.itemnames = texturemode_names;
	// jkrige - anisotropic filtering


	s_fs_box.generic.type = MTYPE_SPINCONTROL;
	s_fs_box.generic.x = 0;
	// jkrige - scale2d
	s_fs_box.generic.y = 40*VID_SCALEFACTOR;
	//s_fs_box.generic.y = 30;
	// jkrige - scale2d
	s_fs_box.generic.name = "fullscreen";
	s_fs_box.itemnames = yesno_names;
	s_fs_box.curvalue = vid_fullscreen->value;


	// jkrige - texture quality
	/*s_tq_slider.generic.type = MTYPE_SLIDER;
	s_tq_slider.generic.x = 0;
	// jkrige - scale2d
	s_tq_slider.generic.y = 50*VID_SCALEFACTOR;
	//s_tq_slider.generic.y = 50;
	// jkrige - scale2d
	s_tq_slider.generic.name = "texture quality";
	s_tq_slider.minvalue = 0;
	s_tq_slider.maxvalue = 3;
	s_tq_slider.curvalue = 3-gl_picmip->value;*/
	// jkrige - texture quality


	// jkrige - palette removal
	//s_paletted_texture_box.generic.type = MTYPE_SPINCONTROL;
	//s_paletted_texture_box.generic.x = 0;
	//s_paletted_texture_box.generic.y = 60;
	//s_paletted_texture_box.generic.name	= "8-bit textures";
	//s_paletted_texture_box.itemnames = yesno_names;
	//s_paletted_texture_box.curvalue = gl_ext_palettedtexture->value;
	// jkrige - palette removal

	s_finish_box.generic.type = MTYPE_SPINCONTROL;
	s_finish_box.generic.x = 0;
	// jkrige - scale2d
	s_finish_box.generic.y = 50*VID_SCALEFACTOR;
	//s_finish_box.generic.y = 70;
	// jkrige - scale2d
	s_finish_box.generic.name = "sync every frame";
	s_finish_box.curvalue = gl_finish->value;
	s_finish_box.itemnames = yesno_names;

	s_defaults_action.generic.type = MTYPE_ACTION;
	s_defaults_action.generic.name = "reset to defaults";
	s_defaults_action.generic.x = 0;
	// jkrige - scale2d
	s_defaults_action.generic.y = 70*VID_SCALEFACTOR;
	//s_defaults_action.generic.y = 90;
	// jkrige - scale2d
	s_defaults_action.generic.callback = ResetDefaults;

	s_cancel_action.generic.type = MTYPE_ACTION;
	s_cancel_action.generic.name = "cancel";
	s_cancel_action.generic.x = 0;
	// jkrige - scale2d
	s_cancel_action.generic.y = 80*VID_SCALEFACTOR;
	//s_cancel_action.generic.y = 100;
	// jkrige - scale2d
	s_cancel_action.generic.callback = CancelChanges;

	
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_mode_list );

	// jkrige - viewsize removal
	//Menu_AddItem( &s_opengl_menu, ( void * ) &s_screensize_slider );
	// jkrige - viewsize removal

	Menu_AddItem( &s_opengl_menu, ( void * ) &s_brightness_slider );


	// jkrige - anisotropic filtering
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_texturemode_box );
	// jkrige - anisotropic filtering


	Menu_AddItem( &s_opengl_menu, ( void * ) &s_fs_box );

	// jkrige - texture quality
	//Menu_AddItem( &s_opengl_menu, ( void * ) &s_tq_slider );
	// jkrige - texture quality

	// jkrige - palette removal
	//Menu_AddItem( &s_opengl_menu, ( void * ) &s_paletted_texture_box );
	// jkrige - palette removal

	Menu_AddItem( &s_opengl_menu, ( void * ) &s_finish_box );

	Menu_AddItem( &s_opengl_menu, ( void * ) &s_defaults_action );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_cancel_action );

	Menu_Center( &s_opengl_menu );
}
Exemplo n.º 16
0
void StartServer_MenuInit (void)
{
	static const char *dm_coop_names[] =
	{
		"deathmatch",
		"cooperative",
		0
	};
	char *buffer;
	char *s;
	int length;
	int i;
	float y;

    // initialize list of maps once, reuse it afterwards (=> it isn't freed)
    if (mapnames == NULL)
    {
		// load the list of map names
		if ((length = FS_LoadFile("maps.lst", (void **)&buffer)) == -1)
			Com_Error (ERR_DROP, "couldn't find maps.lst\n");
	
		s = buffer;	
		i = 0;
	
		while (i < length)
		{
			if (s[i] == '\r')
				nummaps++;	
			i++;
		}
	
		if (nummaps == 0)
			Com_Error (ERR_DROP, "no maps in maps.lst\n");	
		mapnames = malloc (sizeof (char *) * (nummaps + 1));
		memset (mapnames, 0, sizeof (char *) * (nummaps + 1));
	
		s = buffer;
	
		for (i = 0; i < nummaps; i++)
		{
			char shortname[MAX_TOKEN_CHARS];
			char longname[MAX_TOKEN_CHARS];
			char scratch[200];
			int	j, l;
	
			strcpy (shortname, COM_Parse (&s));
			l = strlen (shortname);
	
			for (j = 0; j < l; j++)
				shortname[j] = toupper (shortname[j]);
	
			strcpy (longname, COM_Parse (&s));
			Com_sprintf (scratch, sizeof (scratch), "%s\n%s", longname, shortname);
	
			mapnames[i] = malloc (strlen (scratch) + 1);
			strcpy (mapnames[i], scratch);
		}

		// levelshot found table
		if (levelshotvalid)
			free(levelshotvalid);
		levelshotvalid = malloc(sizeof(byte) * (nummaps + 1));
		memset(levelshotvalid, 0, sizeof(byte) * (nummaps + 1));

		// register null levelshot
		if (levelshotvalid[nummaps] == M_UNSET)
		{
			if (RE_Draw_RegisterPic("levelshots/unknownmap.png"))
				levelshotvalid[nummaps] = M_FOUND;
			else
				levelshotvalid[nummaps] = M_MISSING;
		}

		mapnames[nummaps] = 0;

		FS_FreeFile (buffer);
    }

	// initialize the menu stuff
	memset(&s_startserver_menu, 0, sizeof(s_startserver_menu));
	s_startserver_menu.x = (int)(SCREEN_WIDTH * 0.50f) - 140;
	s_startserver_menu.nitems = 0;

	y = 0;
	s_startmap_list.generic.type = MTYPE_SPINCONTROL;
	s_startmap_list.generic.x = 0;
	s_startmap_list.generic.y = y;
	s_startmap_list.generic.name = "initial map";
    s_startmap_list.itemnames = (const char **)mapnames;

	y += 2 * MENU_LINE_SIZE;
	s_rules_box.generic.type = MTYPE_SPINCONTROL;
	s_rules_box.generic.x = 0;
	s_rules_box.generic.y = y;
	s_rules_box.generic.name = "rules";
	s_rules_box.itemnames = dm_coop_names;
	if (Cvar_VariableValue ("coop"))
		s_rules_box.curvalue = 1;
	else
		s_rules_box.curvalue = 0;
	s_rules_box.generic.callback = RulesChangeFunc;

	y += 2 * MENU_LINE_SIZE;
	s_timelimit_field.generic.type = MTYPE_FIELD;
	s_timelimit_field.generic.name = "time limit";
	s_timelimit_field.generic.flags = QMF_NUMBERSONLY;
	s_timelimit_field.generic.x	= 0;
	s_timelimit_field.generic.y	= y;
	s_timelimit_field.generic.statusbar = "0 = no limit";
	s_timelimit_field.length = 4;
	s_timelimit_field.visible_length = 4;
	strcpy (s_timelimit_field.buffer, Cvar_VariableString ("timelimit"));
	s_timelimit_field.cursor = strlen(s_timelimit_field.buffer);

	y += 2 * MENU_LINE_SIZE;
	s_fraglimit_field.generic.type = MTYPE_FIELD;
	s_fraglimit_field.generic.name = "frag limit";
	s_fraglimit_field.generic.flags = QMF_NUMBERSONLY;
	s_fraglimit_field.generic.x	= 0;
	s_fraglimit_field.generic.y	= y;
	s_fraglimit_field.generic.statusbar = "0 = no limit";
	s_fraglimit_field.length = 4;
	s_fraglimit_field.visible_length = 4;
	strcpy (s_fraglimit_field.buffer, Cvar_VariableString ("fraglimit"));
	s_fraglimit_field.cursor = strlen(s_fraglimit_field.buffer);

	// maxclients determines the maximum number of players that can join
	// the game. If maxclients is only "1" then we should default the menu
	// option to 8 players, otherwise use whatever its current value is.
	// Clamping will be done when the server is actually started.
	y += 2 * MENU_LINE_SIZE;
	s_maxclients_field.generic.type = MTYPE_FIELD;
	s_maxclients_field.generic.name = "max players";
	s_maxclients_field.generic.flags = QMF_NUMBERSONLY;
	s_maxclients_field.generic.x = 0;
	s_maxclients_field.generic.y = y;
	s_maxclients_field.generic.statusbar = NULL;
	s_maxclients_field.length = 3;
	s_maxclients_field.visible_length = 3;
	if (Cvar_VariableValue ("maxclients") == 1)
		strcpy (s_maxclients_field.buffer, "8");
	else
		strcpy (s_maxclients_field.buffer, Cvar_VariableString ("maxclients"));
	s_maxclients_field.cursor = strlen(s_maxclients_field.buffer);

	y += 2 * MENU_LINE_SIZE;
	s_hostname_field.generic.type = MTYPE_FIELD;
	s_hostname_field.generic.name = "hostname";
	s_hostname_field.generic.x = 0;
	s_hostname_field.generic.y = y;
	s_hostname_field.generic.statusbar = NULL;
	s_hostname_field.length = 12;
	s_hostname_field.visible_length = 12;
	strcpy (s_hostname_field.buffer, Cvar_VariableString ("hostname"));
	s_hostname_field.cursor = strlen(s_hostname_field.buffer);

	y += 2 * MENU_LINE_SIZE;
	s_startserver_dmoptions_action.generic.type = MTYPE_ACTION;
	s_startserver_dmoptions_action.generic.name	= S_COLOR_BLUE " deathmatch flags";
	s_startserver_dmoptions_action.generic.flags = QMF_LEFT_JUSTIFY;
	s_startserver_dmoptions_action.generic.x = 0;
	s_startserver_dmoptions_action.generic.y = y;
	s_startserver_dmoptions_action.generic.statusbar = NULL;
	s_startserver_dmoptions_action.generic.callback = DMOptionsFunc;

	y += 3 * MENU_LINE_SIZE;
	s_startserver_start_action.generic.type = MTYPE_ACTION;
	s_startserver_start_action.generic.name	= S_COLOR_BLUE " begin";
	s_startserver_start_action.generic.flags = QMF_LEFT_JUSTIFY;
	s_startserver_start_action.generic.x = 0;
	s_startserver_start_action.generic.y = y;
	s_startserver_start_action.generic.callback = StartServerActionFunc;

	s_startserver_menu.draw = StartServer_MenuDraw;
	s_startserver_menu.key = NULL;

	Menu_AddItem (&s_startserver_menu, &s_startmap_list);
	Menu_AddItem (&s_startserver_menu, &s_rules_box);
	Menu_AddItem (&s_startserver_menu, &s_timelimit_field);
	Menu_AddItem (&s_startserver_menu, &s_fraglimit_field);
	Menu_AddItem (&s_startserver_menu, &s_maxclients_field);
	Menu_AddItem (&s_startserver_menu, &s_hostname_field);
	Menu_AddItem (&s_startserver_menu, &s_startserver_dmoptions_action);
	Menu_AddItem (&s_startserver_menu, &s_startserver_start_action);

	Menu_Center (&s_startserver_menu);

	// call this now to set proper inital state
	RulesChangeFunc (NULL);
}
Exemplo n.º 17
0
static void Performance_Init( void )
{
    menucommon_t *menuitem;
    int yoffset = 0;

    char custom_resolution[64];
    static char **resolutions;

    static char *colordepth_names[] = { "desktop", "16 bits", "32 bits", 0 };

    static char *plighting_names[] = { "vertex (fast)", "lightmaps (normal)", "per pixel (quality)", "per pixel (no specular)", 0 };

    static char **texfilter_names;
    int anisotropic, spinindex;

#ifndef PREDEFINES_PROFILES
    if( !gfx_profiles )
    {
        int i = 0, num, total, len;
        char *current, buffer[1024];
        total = trap_FS_GetFileList( "profiles", ".cfg", NULL, 0, 0, 0 );

        if( total )
            gfx_profiles = UI_Malloc( sizeof( char * ) * ( total + 1 ) );

        while( i < total )
        {
            if( ( num = trap_FS_GetFileList( "profiles", ".cfg", buffer, sizeof( buffer ), i, total ) ) == 0 )
            {
                i++; // can happen if the filename is too long to fit into the buffer or we're done
                continue;
            }

            // add profiles to profiles list
            for( current = buffer ; num ; i++, num--, current += len )
            {
                len = strlen( current ) + 1;
                if( strncmp( current, "gfx_", 4 ) )
                    continue;

                COM_StripExtension( current );

                gfx_profiles[i] = UI_Malloc( strlen( current + 4 ) + 1 );
                strcpy( gfx_profiles[i], current + 4 );
            }
        }
    }
#endif

    if( !resolutions )
    {   // count video modes
        int i, width, height;
        qboolean wideScreen;

        for( i = 0; trap_VID_GetModeInfo( &width, &height, &wideScreen, i - 1 ); i++ ) ;

        resolutions = (char **)UI_Malloc( sizeof( char * ) * ( i + 1 ) );

        for( i = 0; trap_VID_GetModeInfo( &width, &height, &wideScreen, i - 1 ); i++ )
        {
            Q_snprintfz( custom_resolution, sizeof( custom_resolution ), "%s%s%i x %i", i ? "" : "custom: ", ( wideScreen ? "W " : "" ), width, height );
            resolutions[i] = UI_CopyString( custom_resolution );
        }
        resolutions[i] = NULL;
    }

    if( !texfilter_names )
    {
        int i, count;

        for( count = 0; ; count++ )
        {
            if( trap_Cvar_Value( "gl_ext_texture_filter_anisotropic_max" ) <= (1<<count) )
                break;
        }

        texfilter_names = (char **)UI_Malloc( sizeof( char * ) * ( count + 1 + 1 ) );

        texfilter_names[0] = UI_CopyString( "bilinear" );
        for( i = 0; i < count; i++ )
            texfilter_names[i+1] = UI_CopyString( va( "trilinear %ixAF", (1<<i) ) );
        texfilter_names[i+1] = NULL;
    }

    menuitem = UI_InitMenuItem( "m_performance_title1", "GRAPHICS OPTIONS", 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    yoffset += trap_SCR_strHeight( menuitem->font );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_profile", "profile", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSpinControl( menuitem, gfx_profiles, trap_Cvar_Value( "ui_gfxprofile" ) );
    yoffset += trap_SCR_strHeight( menuitem->font );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_applyprofile", "apply profile", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, ApplyProfileButton );
    Menu_AddItem( &s_performance_menu, menuitem );
    yoffset += 1.5 * UI_SetupButton( menuitem, qtrue );

    menuitem = UI_InitMenuItem( "m_performance_resolution", "resolution", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSpinControl( menuitem, resolutions, max( trap_Cvar_Value( "r_mode" ), -1 ) + 1 );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_fullscreen", "fullscreen", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSpinControl( menuitem, noyes_names, trap_Cvar_Value( "vid_fullscreen" ) != 0 );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_swapinterval", "vertical sync", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSpinControl( menuitem, noyes_names, trap_Cvar_Value( "r_swapinterval" ) );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_gamma", "brightness", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSlider( menuitem, 12, bound( (int)( trap_Cvar_Value( "r_gamma" ) * 10.0f ), 5, 13 ), 5, 13 );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_colorbits", "color quality", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    if( !Q_stricmp( trap_Cvar_String( "r_colorbits" ), "16" ) )
        UI_SetupSpinControl( menuitem, colordepth_names, 1 );
    else if( !Q_stricmp( trap_Cvar_String( "r_colorbits" ), "32" ) )
        UI_SetupSpinControl( menuitem, colordepth_names, 2 );
    else
        UI_SetupSpinControl( menuitem, colordepth_names, 0 );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_picmip", "texture quality", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSlider( menuitem, 12, 6-trap_Cvar_Value( "r_picmip" ), 0, 6 );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_filter", "texture filter", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    anisotropic = trap_Cvar_Value( "r_texturefilter" );
    if( anisotropic >= 2 )
        spinindex = NEARESTEXPOF2( anisotropic ) + 1;
    else if( !Q_stricmp( trap_Cvar_String( "r_texturemode" ), "GL_LINEAR_MIPMAP_NEAREST" ) )
        spinindex = 0;
    else
        spinindex = 1;
    UI_SetupSpinControl( menuitem, texfilter_names, spinindex );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_skymip", "sky quality", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSlider( menuitem, 12, (trap_Cvar_Value( "r_fastsky" ) ? 0 : 4-trap_Cvar_Value( "r_skymip" )), 0, 4 );
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_LOD_slider", "geometry level of detail", 0, yoffset, MTYPE_SLIDER, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSlider( menuitem, 12, 4-max( trap_Cvar_Value( "r_lodbias" ), NEARESTEXPOF2( trap_Cvar_Value( "r_subdivisions" ) ) ), 0, 4 );
    yoffset += trap_SCR_strHeight( menuitem->font );

#if 0
    menuitem = UI_InitMenuItem( "m_performance_glsl", "opengl shaders", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSpinControl( menuitem, offon_names, trap_Cvar_Value( "gl_ext_GLSL" ) );
    yoffset += trap_SCR_strHeight( menuitem->font );
#endif

    if( trap_Cvar_Value( "r_lighting_vertexlight" ) )
        spinindex = 0;
    else if( !trap_Cvar_Value( "r_lighting_deluxemapping" ) )
        spinindex = 1;
    else if( trap_Cvar_Value( "r_lighting_specular" ) )
        spinindex = 2;
    else
        spinindex = 3;

    menuitem = UI_InitMenuItem( "m_performance_pplighting", "lighting", 0, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupSpinControl( menuitem, plighting_names, spinindex );
    yoffset += trap_SCR_strHeight( menuitem->font );

    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_performance_back", "back", -16, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_genericBackFunc );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupButton( menuitem, qtrue );
    menuitem = UI_InitMenuItem( "m_performance_apply", "apply", 16, yoffset, MTYPE_ACTION, ALIGN_LEFT_TOP, uis.fontSystemBig, ApplyButton );
    Menu_AddItem( &s_performance_menu, menuitem );
    yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;;

    yoffset += trap_SCR_strHeight( uis.fontSystemSmall );

    menuitem = UI_InitMenuItem( "m_performance_advanced", "advanced options", 0, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, AdvancedButton );
    Menu_AddItem( &s_performance_menu, menuitem );
    UI_SetupButton( menuitem, qtrue );

    Menu_Center( &s_performance_menu );
    Menu_Init( &s_performance_menu, qfalse );
}
Exemplo n.º 18
0
/*
** VID_MenuInit
*/
void VID_MenuInit( void )
{
	static const char *resolutions[] = 
	{
		"[320 240  ]",
		"[400 300  ]",
		"[512 384  ]",
		"[640 480  ]",
		"[800 600  ]",
		"[960 720  ]",
		"[1024 480 ]",		// c14 new mode - Sony PictureBook C1VFK support
		"[1024 768 ]",
		"[1152 864 ]",
		"[1280 768 ]",		// David M. Pochron
		"[1280 960 ]",
		"[1280 1024]",		// TheInvisible
		"[1600 1200]",
		"[2048 1536]",
		// NeVo - World Video Resolutions
		"[Std. NTSC 601   ]",		// Std NTSC 601		720x540
		"[Std. NTSC DV/DVD]",		// Std NTSC DV/DVD	720x534
		"[Wide NTSC 601   ]",		// Wide NTSC 601	864x486
		"[Wide NTSC DV/DVD]",		// Wide NTSC DV/DVD	864x480
		"[Std PAL         ]",		// Std PAL			768x576
		"[Wide PAL        ]",		// Wide PAL			1024x576
		"[HDTV 720P       ]",		// HDTV 720P		1280x720
		"[HDTV 1080i      ]",		// HDTV 1080i		1920x1080
		0
	};
	static const char *refs[] =
	{
		"[Software      ]",
		"[System OpenGL ]",		// NeVo
		"[3Dfx OpenGL   ]",
		"[PowerVR OpenGL]",
		"[Rendition OpenGL]",	// NeVo
//		"[Direct 3D 9.0	]",		// NeVo
		0
	};
	static const char *yesno_names[] =
	{
		"No",
		"Yes",
		0
	};
	static const char *hilo_names[] =
	{
		"Low",
		"High",
		0
	};
	// NeVo - aspect ratio support
	static const char *aspect_ratios[] =
	{
		"[1.33:1 - Default]",
		"[1.78:1 - HDTV   ]",
		"[2.35:1 - Cinema ]",
		0
	};

	// NeVo - overbrights list
	static const char *overbright_modes[] =
	{
		"Off",
		"Low",
		"High",
		0
	};

	// NeVo - camera modes
	static const char *cam_modes[] =
	{
		"First Person",
		"Third Person",
		0
	};

	int i;

	ui_fogenabled = Cvar_Get ("ui_fogenabled", "1", CVAR_ARCHIVE);	// NeVo - this is a goddamn hack

	if ( !gl_driver )
		gl_driver = Cvar_Get( "gl_driver", "opengl32", 0 );
	if ( !gl_picmip )
		gl_picmip = Cvar_Get( "gl_picmip", "0", 0 );
	if ( !gl_mode )
		gl_mode = Cvar_Get( "gl_mode", "3", 0 );
	if ( !sw_mode )
		sw_mode = Cvar_Get( "sw_mode", "0", 0 );
	if ( !gl_ext_palettedtexture )
		gl_ext_palettedtexture = Cvar_Get( "gl_ext_palettedtexture", "1", CVAR_ARCHIVE );
	if ( !gl_finish )
		gl_finish = Cvar_Get( "gl_finish", "0", CVAR_ARCHIVE );

	if ( !sw_stipplealpha )
		sw_stipplealpha = Cvar_Get( "sw_stipplealpha", "0", CVAR_ARCHIVE );

	s_mode_list[SOFTWARE_MENU].curvalue = sw_mode->value;
	s_mode_list[OPENGL_MENU].curvalue = gl_mode->value;

	if ( !scr_viewsize )
		scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE);

	s_screensize_slider[SOFTWARE_MENU].curvalue = scr_viewsize->value/10;
	s_screensize_slider[OPENGL_MENU].curvalue = scr_viewsize->value/10;

	if ( strcmp( vid_ref->string, "soft" ) == 0 )
	{
		s_current_menu_index = SOFTWARE_MENU;
		s_ref_list[0].curvalue = s_ref_list[1].curvalue = REF_SOFT;
	}
	else if ( strcmp( vid_ref->string, "gl" ) == 0 )
	{
		s_current_menu_index = OPENGL_MENU;
		if ( strcmp( gl_driver->string, "3dfxgl" ) == 0 )
			s_ref_list[s_current_menu_index].curvalue = REF_3DFX;
		else if ( strcmp( gl_driver->string, "pvrgl" ) == 0 )
			s_ref_list[s_current_menu_index].curvalue = REF_POWERVR;
		else if ( strcmp( gl_driver->string, "opengl32" ) == 0 )
			s_ref_list[s_current_menu_index].curvalue = REF_OPENGL;
		else if ( strcmp( gl_driver->string, "veritegl" ) == 0 )		// NeVo
			s_ref_list[s_current_menu_index].curvalue = REF_VERITE;
		else
			s_ref_list[s_current_menu_index].curvalue = REF_OPENGL;
	}

	s_software_menu.x		= viddef.width * 0.50;
	s_software_menu.y		= (viddef.height * 0.50) - 58;
	s_software_menu.nitems	= 0;
	s_opengl_menu.x			= viddef.width * 0.50;
	s_opengl_menu.y			= (viddef.height * 0.50) - 58;
	s_opengl_menu.nitems	= 0;

	for ( i = 0; i < 2; i++ )
	{
		s_ref_list[i].generic.type = MTYPE_SPINCONTROL;
		s_ref_list[i].generic.name = "Driver";
		s_ref_list[i].generic.x = 0;
		s_ref_list[i].generic.y = 0;
		s_ref_list[i].generic.callback = DriverCallback;
		s_ref_list[i].itemnames = refs;

		s_mode_list[i].generic.type = MTYPE_SPINCONTROL;
		s_mode_list[i].generic.name = "Video Mode";
		s_mode_list[i].generic.x = 0;
		s_mode_list[i].generic.y = 10;
		s_mode_list[i].itemnames = resolutions;

		s_screensize_slider[i].generic.type	= MTYPE_SLIDER;
		s_screensize_slider[i].generic.x		= 0;
		s_screensize_slider[i].generic.y		= 20;
		s_screensize_slider[i].generic.name	= "Screen Size";
		s_screensize_slider[i].minvalue = 3;
		s_screensize_slider[i].maxvalue = 12;
		s_screensize_slider[i].generic.callback = ScreenSizeCallback;

		s_brightness_slider[i].generic.type	= MTYPE_SLIDER;
		s_brightness_slider[i].generic.x	= 0;
		s_brightness_slider[i].generic.y	= 30;
		s_brightness_slider[i].generic.name	= "Brightness";
		s_brightness_slider[i].generic.callback = BrightnessCallback;
		s_brightness_slider[i].minvalue = 5;
		s_brightness_slider[i].maxvalue = 13;
		s_brightness_slider[i].curvalue = ( 1.3 - vid_gamma->value + 0.5 ) * 10;

		s_fs_box[i].generic.type = MTYPE_SPINCONTROL;
		s_fs_box[i].generic.x	= 0;
		s_fs_box[i].generic.y	= 40;
		s_fs_box[i].generic.name	= "Fullscreen";
		s_fs_box[i].itemnames = yesno_names;
		s_fs_box[i].curvalue = vid_fullscreen->value;

		// NeVo - camera modes
		s_cameramode_list[i].generic.type = MTYPE_SPINCONTROL;
		s_cameramode_list[i].generic.x	= 0;
		s_cameramode_list[i].generic.y	= 50;
		s_cameramode_list[i].generic.name	= "Camera Mode";
		s_cameramode_list[i].itemnames = cam_modes;
		s_cameramode_list[i].curvalue = Cvar_VariableValue("cl_thirdPerson->value");

		// NeVo - aspect ratio support
		s_aspect_ratio_list[i].generic.type = MTYPE_SPINCONTROL;
		s_aspect_ratio_list[i].generic.x	= 0;
		s_aspect_ratio_list[i].generic.y	= 110;
		s_aspect_ratio_list[i].generic.name = "Aspect Ratio";
		s_aspect_ratio_list[i].itemnames = aspect_ratios;
		s_aspect_ratio_list[i].curvalue	= Cvar_VariableValue("vid_widescreen");
		//s_aspect_ratio_list[i].generic.callback = AspectRatioCallback;	// NeVo - obsolete

		s_defaults_action[i].generic.type = MTYPE_ACTION;
		s_defaults_action[i].generic.name = "Reset to Defaults";
		s_defaults_action[i].generic.x    = 0;
		s_defaults_action[i].generic.y    = 120;
		s_defaults_action[i].generic.callback = ResetDefaults;

		s_apply_action[i].generic.type = MTYPE_ACTION;
		s_apply_action[i].generic.name = "Apply Changes";
		s_apply_action[i].generic.x    = 0;
		s_apply_action[i].generic.y    = 130;
		s_apply_action[i].generic.callback = ApplyChanges;

		s_cancel_action[i].generic.type = MTYPE_ACTION;
		s_cancel_action[i].generic.name = "Options Menu";
		s_cancel_action[i].generic.x    = 0;
		s_cancel_action[i].generic.y    = 140;
		s_cancel_action[i].generic.callback = M_Menu_Options_f;
	}

	s_stipple_box.generic.type = MTYPE_SPINCONTROL;
	s_stipple_box.generic.x	= 0;
	s_stipple_box.generic.y	= 60;
	s_stipple_box.generic.name	= "Dither Alpha";
	s_stipple_box.curvalue = sw_stipplealpha->value;
	s_stipple_box.itemnames = yesno_names;

	s_tq_slider.generic.type	= MTYPE_SLIDER;
	s_tq_slider.generic.x		= 0;
	s_tq_slider.generic.y		= 60;
	s_tq_slider.generic.name	= "Texture Quality";
	s_tq_slider.minvalue = 0;
	s_tq_slider.maxvalue = 3;
	s_tq_slider.curvalue = 3-gl_picmip->value;

	s_paletted_texture_box.generic.type = MTYPE_SPINCONTROL;
	s_paletted_texture_box.generic.x	= 0;
	s_paletted_texture_box.generic.y	= 70;
	s_paletted_texture_box.generic.name	= "Texture Resolution";
	s_paletted_texture_box.itemnames = hilo_names;
	s_paletted_texture_box.curvalue = gl_ext_palettedtexture->value;

	s_finish_box.generic.type = MTYPE_SPINCONTROL;
	s_finish_box.generic.x	= 0;
	s_finish_box.generic.y	= 80;
	s_finish_box.generic.name	= "Sync Every Frame";
	s_finish_box.curvalue = gl_finish->value;
	s_finish_box.itemnames = yesno_names;

	// Overbrights mode
	s_overbrights_list.generic.type = MTYPE_SPINCONTROL;
	s_overbrights_list.generic.x	= 0;
	s_overbrights_list.generic.y	= 90;
	s_overbrights_list.generic.name	= "Overbrights";
	s_overbrights_list.curvalue = Cvar_VariableValue("r_overbrightbits")*0.5;
	s_overbrights_list.itemnames = overbright_modes;

	// Fog mode
	s_fogtoggle_list.generic.type = MTYPE_SPINCONTROL;
	s_fogtoggle_list.generic.x	= 0;
	s_fogtoggle_list.generic.y	= 100;
	s_fogtoggle_list.generic.name	= "Fog Enabled";
	s_fogtoggle_list.curvalue = ui_fogenabled->value;
	s_fogtoggle_list.itemnames = yesno_names;

	Menu_AddItem( &s_software_menu, ( void * ) &s_ref_list[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_mode_list[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_screensize_slider[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_brightness_slider[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_fs_box[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_stipple_box );

	Menu_AddItem( &s_opengl_menu, ( void * ) &s_ref_list[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_mode_list[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_screensize_slider[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_brightness_slider[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_fs_box[OPENGL_MENU] );

	// NeVo - camera modes
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_cameramode_list[OPENGL_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_cameramode_list[SOFTWARE_MENU] );

	Menu_AddItem( &s_opengl_menu, ( void * ) &s_tq_slider );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_paletted_texture_box );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_finish_box );

	// NeVo - fog and overbrights
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_overbrights_list );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_fogtoggle_list );

	// NeVo - aspect ratio support
	Menu_AddItem( &s_software_menu, ( void * ) &s_aspect_ratio_list[SOFTWARE_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_aspect_ratio_list[OPENGL_MENU] );

	Menu_AddItem( &s_software_menu, ( void * ) &s_defaults_action[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_apply_action[SOFTWARE_MENU] );
	Menu_AddItem( &s_software_menu, ( void * ) &s_cancel_action[SOFTWARE_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_defaults_action[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_apply_action[OPENGL_MENU] );
	Menu_AddItem( &s_opengl_menu, ( void * ) &s_cancel_action[OPENGL_MENU] );

	Menu_Center( &s_software_menu );
	Menu_Center( &s_opengl_menu );
	s_opengl_menu.x -= 8;
	s_software_menu.x -= 8;
}
Exemplo n.º 19
0
static qboolean StartServer_MenuInit( void )
{
    menucommon_t *menuitem_settings_background;
    menucommon_t *menuitem, *col_title;
    static char *skill_names[] = { "easy", "normal", "hard", 0 };
    static char *sortmethod_names[] = { "file name", "title", 0 };
    cvar_t *cvar_lastmap;
    int maxclients;
    int scrollwindow_width, xoffset, yoffset = 0; //leave some room for preview pic

    trap_Cvar_Get( "ui_maplist_sortmethod", "1", CVAR_ARCHIVE );

    // create a list with the installed gametype names
    ui_gametype_names = trap_Cvar_Get( "ui_gametype_names", ";", CVAR_NOSET );
    if( !UI_CreateFileNamesListCvar( ui_gametype_names, "progs/gametypes", ".gt", ';' ) )
        trap_Cvar_ForceSet( "ui_gametype_names", "dm;" );

    if( uis.vidWidth < 800 )
        scrollwindow_width = uis.vidWidth * 0.85;
    else if( uis.vidWidth < 1024 )
        scrollwindow_width = uis.vidWidth * 0.75;
    else
        scrollwindow_width = uis.vidWidth * 0.45;
    xoffset = scrollwindow_width / 2;

    // convert to item names format
    M_StartServer_MakeGametypesNames( ui_gametype_names->string );

    s_startserver_menu.nitems = 0;

    menuitem = UI_InitMenuItem( "m_startserver_title1", "SERVER SETUP", 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemBig, NULL );
    Menu_AddItem( &s_startserver_menu, menuitem );
    yoffset += trap_SCR_strHeight( menuitem->font );

    // separator
    yoffset += trap_SCR_strHeight( menuitem->font );

    menuitem = UI_InitMenuItem( "m_startserver_map", "initial map", 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemMedium, NULL );
    Menu_AddItem( &s_startserver_menu, menuitem );
    yoffset += trap_SCR_strHeight( menuitem->font );

    yoffset += trap_SCR_strHeight( menuitem->font ) * 0.5;

    // order type
    menuitem = col_title = UI_InitMenuItem( "m_startserver_order_title", "order by: ", -xoffset - LCOLUMN_OFFSET / 2, yoffset, MTYPE_SEPARATOR, ALIGN_LEFT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_startserver_menu, menuitem );

    menuitem = UI_InitMenuItem( "m_startserver_order", NULL, col_title->x + trap_SCR_strWidth( col_title->title, uis.fontSystemSmall, 0 ),
                                yoffset, MTYPE_SPINCONTROL, ALIGN_LEFT_TOP, uis.fontSystemSmall, StartServer_UpdateOrderMethod );
    UI_SetupSpinControl( menuitem, sortmethod_names, trap_Cvar_Value( "ui_maplist_sortmethod" ) );
    Menu_AddItem( &s_startserver_menu, menuitem );

    menuitem = UI_InitMenuItem( "m_startserver_mappic", NULL, xoffset - MAPPIC_WIDTH - 8, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_startserver_menu, menuitem );

    cvar_lastmap = trap_Cvar_Get( "ui_startserver_lastselectedmap", "", CVAR_NOSET );
    MapsList_CreateItems( cvar_lastmap->string );
    MapsList_ChooseMap( NULL );

    yoffset += trap_SCR_strHeight( menuitem->font );
    yoffset = MapsList_CreateScrollbox( scrollwindow_width, yoffset );

    yoffset += trap_SCR_strHeight( menuitem->font ) * 0.5;

    menuitem_settings_background = UI_InitMenuItem( "m_startserver_settings_back", "", -xoffset, yoffset, MTYPE_SEPARATOR, ALIGN_LEFT_TOP, uis.fontSystemSmall, NULL );
    Menu_AddItem( &s_startserver_menu, menuitem_settings_background );
    // create an associated picture to the items to act as window background
    menuitem = menuitem_settings_background;
    menuitem->ownerdraw = M_StartServer_DrawSettingsBox;
    menuitem->pict.shader = uis.whiteShader;
    menuitem->pict.shaderHigh = NULL;
    Vector4Copy( colorMdGrey, menuitem->pict.color );
    menuitem->pict.color[3] = 0;
    menuitem->pict.yoffset = 0;
    menuitem->pict.xoffset = 0;
    menuitem->pict.width = scrollwindow_width;
    menuitem->pict.height = yoffset + menuitem->pict.yoffset; // will be set later

    yoffset += trap_SCR_strHeight( menuitem->font );

    // g_gametype
    m_gametype = mapList_suggested_gametype ? mapList_suggested_gametype : SuggestGameType( NULL );
    menuitem = m_gametypes_item = UI_InitMenuItem( "m_startserver_gametype", "gametype", -130, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_GametypeFunc );
    menuitem->statusbar = "select the server gametype";
    UI_SetupSpinControl( menuitem, startserver_gametype_names, m_gametype );
    Menu_AddItem( &s_startserver_menu, menuitem );
    //yoffset += trap_SCR_strHeight( menuitem->font );

    // g_timelimit
    menuitem = UI_InitMenuItem( "m_startserver_timelimit", "time limit", 100, yoffset, MTYPE_FIELD, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    menuitem->statusbar = "0 = no limit";
    UI_SetupField( menuitem, trap_Cvar_String( "g_timelimit" ), 6, -1 );
    UI_SetupFlags( menuitem, F_NUMBERSONLY );
    Menu_AddItem( &s_startserver_menu, menuitem );
    yoffset += trap_SCR_strHeight( menuitem->font );

    // sv_skilllevel
    menuitem = UI_InitMenuItem( "m_startserver_skill", "skill level", -130, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_SkillLevelFunc );
    m_skill = trap_Cvar_Value( "sv_skilllevel" );
    menuitem->statusbar = "select server skill level";
    UI_SetupSpinControl( menuitem, skill_names, m_skill );
    Menu_AddItem( &s_startserver_menu, menuitem );
    //yoffset += trap_SCR_strHeight( menuitem->font );

    // g_scorelimit
    menuitem = UI_InitMenuItem( "m_startserver_scorelimit", "score limit", 100, yoffset, MTYPE_FIELD, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    menuitem->statusbar = "0 = no limit";
    UI_SetupField( menuitem, trap_Cvar_String( "g_scorelimit" ), 6, -1 );
    UI_SetupFlags( menuitem, F_NUMBERSONLY );
    Menu_AddItem( &s_startserver_menu, menuitem );
    yoffset += trap_SCR_strHeight( menuitem->font );

    // sv_cheats
    menuitem = UI_InitMenuItem( "m_startserver_cheats", "cheats", -130, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_CheatsFunc );
    m_cheats = trap_Cvar_Value( "sv_cheats" );
    menuitem->statusbar = "enable cheats on the server";
    UI_SetupSpinControl( menuitem, offon_names, m_cheats );
    Menu_AddItem( &s_startserver_menu, menuitem );
    //yoffset += trap_SCR_strHeight( menuitem->font );

    // g_numbots
    menuitem = UI_InitMenuItem( "m_startserver_numbots", "number of bots", 100, yoffset, MTYPE_FIELD, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    menuitem->statusbar = "Can't be more than maxclients";
    UI_SetupField( menuitem, trap_Cvar_String( "g_numbots" ), 6, -1 );
    UI_SetupFlags( menuitem, F_NUMBERSONLY );
    Menu_AddItem( &s_startserver_menu, menuitem );
    yoffset += trap_SCR_strHeight( menuitem->font );

    // g_instagib
    menuitem = UI_InitMenuItem( "m_startserver_instagib", "instagib", -130, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_InstagibFunc );
    m_instagib = trap_Cvar_Value( "g_instagib" );
    menuitem->statusbar = "enable instagib mode";
    UI_SetupSpinControl( menuitem, offon_names, m_instagib );
    Menu_AddItem( &s_startserver_menu, menuitem );
    //yoffset += trap_SCR_strHeight( menuitem->font );

    // sv_maxclients
    /*
    ** maxclients determines the maximum number of players that can join
    ** the game.  If maxclients is only "1" then we should default the menu
    ** option to 8 players, otherwise use whatever its current value is.
    */
    maxclients = trap_Cvar_Value( "sv_maxclients" ) <= 1 ? 8 : trap_Cvar_Value( "sv_maxclients" );
    menuitem = UI_InitMenuItem( "m_startserver_maxplayers", "max players", 100, yoffset, MTYPE_FIELD, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    UI_SetupField( menuitem, va( "%i", maxclients ), 6, -1 );
    UI_SetupFlags( menuitem, F_NUMBERSONLY );
    Menu_AddItem( &s_startserver_menu, menuitem );
    yoffset += trap_SCR_strHeight( menuitem->font );

    // sv_public
    menuitem = UI_InitMenuItem( "m_startserver_public", "public", -130, yoffset, MTYPE_SPINCONTROL, ALIGN_RIGHT_TOP, uis.fontSystemSmall, M_PublicFunc );
    m_public = trap_Cvar_Value( "sv_public" );
    menuitem->statusbar = "announce this server to metaservers";
    UI_SetupSpinControl( menuitem, offon_names, m_public );
    Menu_AddItem( &s_startserver_menu, menuitem );
    //yoffset += trap_SCR_strHeight( menuitem->font );

    // sv_hostname
    menuitem = UI_InitMenuItem( "m_startserver_hostname", "server name", 100, yoffset, MTYPE_FIELD, ALIGN_RIGHT_TOP, uis.fontSystemSmall, NULL );
    UI_SetupField( menuitem, trap_Cvar_String( "sv_hostname" ), 14, -1 );
    Menu_AddItem( &s_startserver_menu, menuitem );
    yoffset += trap_SCR_strHeight( menuitem->font );

    yoffset += trap_SCR_strHeight( menuitem->font ) * 0.5;

    // here ends the settings background, set it's image height now
    menuitem_settings_background->pict.height = yoffset - menuitem_settings_background->pict.height + ( 0.5 * trap_SCR_strHeight( menuitem->font ) );

    yoffset += trap_SCR_strHeight( menuitem->font );

    // begin button
    menuitem = UI_InitMenuItem( "m_startserver_begin", "begin", 16, yoffset, MTYPE_ACTION, ALIGN_LEFT_TOP, uis.fontSystemBig, StartServerActionFunc );
    Menu_AddItem( &s_startserver_menu, menuitem );
    UI_SetupButton( menuitem, qtrue );

    menuitem = UI_InitMenuItem( "m_startserver_back", "back", -16, yoffset, MTYPE_ACTION, ALIGN_RIGHT_TOP, uis.fontSystemBig, M_genericBackFunc );
    Menu_AddItem( &s_startserver_menu, menuitem );
    yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

    Menu_Center( &s_startserver_menu );
    s_startserver_menu.x = ( uis.vidWidth / 2 );
    Menu_Init( &s_startserver_menu, qfalse );
    return qtrue;
}