Exemple #1
0
static void M_GetTeamColor( void )
{
	int rgbcolor;
	menucommon_t *menuitem;

	rgbcolor = COM_ReadColorRGBString( color->string );
	if( rgbcolor == -1 )
	{
		rgbcolor = COM_ReadColorRGBString( color->dvalue );
	}
	if( rgbcolor != -1 )
	{
		Vector4Set( playerColor, COLOR_R( rgbcolor ), COLOR_G( rgbcolor ), COLOR_B( rgbcolor ), 255 );
	}
	else
	{
		Vector4Set( playerColor, 255, 255, 255, 255 ); // start white
	}

	// update the bars
	menuitem = UI_MenuItemByName( "m_TeamConfig_colorred" );
	menuitem->curvalue = playerColor[0];
	menuitem = UI_MenuItemByName( "m_TeamConfig_colorgreen" );
	menuitem->curvalue = playerColor[1];
	menuitem = UI_MenuItemByName( "m_TeamConfig_colorblue" );
	menuitem->curvalue = playerColor[2];
}
Exemple #2
0
static void M_GetTeamModel( void )
{
	menucommon_t *menuitem;
	m_listitem_t *item;
	playermodelinfo_s *playermodel;
	int currentdirectoryindex = 0;
	int currentskinindex = 0;

	if( currentTEAM < TEAM_PLAYERS )
		currentTEAM = TEAM_PLAYERS;
	if( currentTEAM >= GS_MAX_TEAMS )
		currentTEAM = GS_MAX_TEAMS - 1;

	// find the skin and model matching our user settings (if any)
	UI_FindIndexForModelAndSkin( model->string, skin->string, &currentdirectoryindex, &currentskinindex );
	menuitem = UI_MenuItemByName( "m_TeamConfig_model" );
	menuitem->curvalue = currentdirectoryindex;

	item = UI_FindItemInScrollListWithId( &playermodelsItemsList, currentdirectoryindex );
	playermodel = (playermodelinfo_s *)item->data;

	menuitem = UI_MenuItemByName( "m_TeamConfig_skin" );
	menuitem->itemnames = playermodel->skinnames;
	menuitem->curvalue = currentskinindex;
}
Exemple #3
0
//=================
//M_TeamConfig_ApplyChanges
//=================
static void M_TeamConfig_ApplyChanges( struct menucommon_s *unused )
{
	menucommon_t *modelitem = UI_MenuItemByName( "m_TeamConfig_model" );
	menucommon_t *skinitem = UI_MenuItemByName( "m_TeamConfig_skin" );

	UpdateTeamCvars();
	if( hasForcedModelMenuItem->curvalue )
	{
		trap_Cvar_Set( model->name, modelitem->itemnames[modelitem->curvalue] );
		trap_Cvar_Set( skin->name, skinitem->itemnames[skinitem->curvalue] );
	}
	else
	{
		trap_Cvar_Set( model->name, "" );
		trap_Cvar_Set( skin->name, "" );
	}

	if( hasForcedColorMenuItem->curvalue )
	{
		trap_Cvar_Set( color->name, va( "%i %i %i", (int)playerColor[0], (int)playerColor[1], (int)playerColor[2] ) );
	}
	else
	{
		trap_Cvar_Set( color->name, "" );
	}
}
Exemple #4
0
static void StartServerActionFunc( menucommon_t *unused )
{
    char *str;
    char mapname[MAX_CONFIGSTRING_CHARS];
    char starservercmd[MAX_STRING_CHARS];

    m_listitem_t *mapitem;
    mapitem = UI_FindItemInScrollListWithId( &mapList, mapList_cur_idx );
    if( !mapitem || !mapitem->name )
        return;

    trap_Cvar_Set( "g_gametype", startserver_gametype_names[m_gametype] );
    trap_Cvar_SetValue( "sv_skilllevel", m_skill );
    trap_Cvar_SetValue( "sv_cheats", m_cheats );
    trap_Cvar_SetValue( "sv_public", m_public );

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_hostname" ) );
    if( str ) trap_Cvar_Set( "sv_hostname", str );

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_maxplayers" ) );
    if( str ) trap_Cvar_Set( "sv_maxclients", str );

    // game stuff, overriding local gametype config
    starservercmd[0] = '\0';
    Q_strncatz( starservercmd, va( "g_instagib %i;", m_instagib ), sizeof( starservercmd ) );
    trap_Cvar_SetValue( "g_instagib", (float)m_instagib );

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_timelimit" ) );
    if( str )
    {
        Q_strncatz( starservercmd, va( "g_timelimit %s;", str ), sizeof( starservercmd ) );
        trap_Cvar_Set( "g_timelimit", str );
    }

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_scorelimit" ) );
    if( str )
    {
        Q_strncatz( starservercmd, va( "g_scorelimit %s;", str ), sizeof( starservercmd ) );
        trap_Cvar_Set( "g_scorelimit", str );
    }

    str = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_startserver_numbots" ) );
    if( str )
    {
        Q_strncatz( starservercmd, va( "g_numbots %s;", str ), sizeof( starservercmd ) );
        trap_Cvar_Set( "g_numbots", str );
    }

    trap_Cvar_ForceSet( "ui_startservercmd", starservercmd );

    if( uis.serverState )
        trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" );

    if( trap_ML_GetMapByNum( (int)((size_t)mapitem->data), mapname, sizeof( mapname ) ) )
        trap_Cvar_ForceSet( "ui_startserver_lastselectedmap", mapname );

    trap_Cmd_ExecuteText( EXEC_APPEND, va( "map \"%s\"\n", mapitem->name ) );
}
Exemple #5
0
static void M_Login_Login( menucommon_t *unused )
{
	char *email, *pass;

	email = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_login_email" ) );
	pass = UI_GetMenuitemFieldBuffer( UI_MenuItemByName( "m_login_pass" ) );
	if( !email || !*email )
	{
		Menu_SetStatusBar( &s_login_menu, "please enter an email address" );
		return;
	}

	if( !pass || !*pass )
	{
		Menu_SetStatusBar( &s_login_menu, "please enter a password" );
		return;
	}

	UI_AuthReply_Callback = Login_AuthReply_Callback;
	//trap_Auth_CheckUser( email, pass );
}
Exemple #6
0
static void ApplyProfileButton( menucommon_t *unused )
{
    menucommon_t *menuitem;
    char cmd[MAX_QPATH + 5 + 1];

    // store profile choice for UI
    menuitem = UI_MenuItemByName( "m_performance_profile" );
    trap_Cvar_ForceSet( "ui_gfxprofile", va( "%i", menuitem->curvalue ) );

    // execute profile
    Q_snprintfz( cmd, sizeof( cmd ), "exec profiles/gfx_%s.cfg\n", gfx_profiles[menuitem->curvalue] );
    trap_Cmd_ExecuteText( EXEC_APPEND, cmd );
}
Exemple #7
0
static void StartServer_MenuDraw( void )
{
    int x, y;
    menucommon_t *item = UI_MenuItemByName( "m_startserver_mappic" );

    x = item->parent->x + item->x;
    y = item->parent->y + item->y;

    Menu_Draw( &s_startserver_menu );

    trap_R_DrawStretchPic( x, y, MAPPIC_WIDTH, MAPPIC_HEIGHT,
                           0, 0, 1, 1, colorWhite, (struct shader_s *)s_levelshot );
}
Exemple #8
0
static void MapsList_ChooseMap( menucommon_t *menuitem )
{
    char path[MAX_CONFIGSTRING_CHARS + 6]; // wsw: Medar: could do this in not so ugly way
    m_listitem_t *item;
    menucommon_t *mapitem;
    char mapinfo[MAX_CONFIGSTRING_CHARS];
    const char *mapname, *fullname;
    int id = ( menuitem ? menuitem->localdata[1] : mapList_cur_idx );

    mapitem = UI_MenuItemByName( "m_startserver_map" );
    if( mapitem )
        Q_strncpyz( mapitem->title, "initial map", sizeof( mapitem->title ) );

    mapList_suggested_gametype = 0;

    item = UI_FindItemInScrollListWithId( &mapList, id );
    if( item && item->name )
    {
        if( !trap_ML_GetMapByNum( (int)((size_t)item->data), mapinfo, sizeof( mapinfo ) ) )
            return;
        mapname = mapinfo;
        fullname = mapinfo + strlen( mapname ) + 1;

        if( menuitem )
        {
            mapList_cur_idx = id;
            trap_Cvar_ForceSet( "ui_startserver_lastselectedmap", "" );
        }

        if( mapitem )
        {
            Q_strncatz( mapitem->title, ": " S_COLOR_WHITE, sizeof( mapitem->title ) );
            if( !trap_Cvar_Value( "ui_maplist_sortmethod" ) )
                Q_strncatz( mapitem->title, mapname, sizeof( mapitem->title ) );
            else
                Q_strncatz( mapitem->title, *fullname ? fullname : mapname, sizeof( mapitem->title ) );
        }

#ifdef SUGGEST_MAP_GAMETYPE
        mapList_suggested_gametype = SuggestGameType( mapname );
//		if( m_gametypes_item )
//		{
//			m_gametypes_item->curvalue = mapList_suggested_gametype;
//			M_GametypeFunc( m_gametypes_item );
//		}
#endif

        Q_snprintfz( path, sizeof( path ), "levelshots/%s.jpg", mapname );
        s_levelshot = trap_R_RegisterLevelshot( path, trap_R_RegisterPic( PATH_UKNOWN_MAP_PIC ), NULL );
    }
}
Exemple #9
0
static void StartServer_UpdateOrderMethod( menucommon_t *menuitem )
{
    char mapinfo[MAX_CONFIGSTRING_CHARS] = { 0 };
    m_listitem_t *mapitem;

    trap_Cvar_SetValue( "ui_maplist_sortmethod", menuitem->curvalue );

    mapitem = UI_FindItemInScrollListWithId( &mapList, mapList_cur_idx );
    if( mapitem && mapitem->name )
        trap_ML_GetMapByNum( (int)((size_t)mapitem->data), mapinfo, sizeof( mapinfo ) );

    MapsList_CreateItems( mapinfo );
    MapsList_ChooseMap( NULL );

    menuitem = UI_MenuItemByName( "m_mapList_scrollbar" );
    menuitem->curvalue = bound( menuitem->minvalue, mapList_cur_idx, menuitem->maxvalue );
    MapsList_UpdateScrollbar( menuitem );
}
Exemple #10
0
static void ApplyButton( menucommon_t *unused )
{
    menucommon_t *menuitem;

    menuitem = UI_MenuItemByName( "m_performance_resolution" );
    trap_Cvar_SetValue( "r_mode", menuitem->curvalue - 1 );

    menuitem = UI_MenuItemByName( "m_performance_fullscreen" );
    trap_Cvar_SetValue( "vid_fullscreen", menuitem->curvalue );

    menuitem = UI_MenuItemByName( "m_performance_gamma" );
    trap_Cvar_SetValue( "r_gamma", menuitem->curvalue/10.0 );

    menuitem = UI_MenuItemByName( "m_performance_colorbits" );
    trap_Cvar_SetValue( "r_colorbits", 16 * menuitem->curvalue );

    menuitem = UI_MenuItemByName( "m_performance_picmip" );
    trap_Cvar_SetValue( "r_picmip", 6 - menuitem->curvalue );

    menuitem = UI_MenuItemByName( "m_performance_filter" );
    if( menuitem->curvalue >= 2 )
    {
        trap_Cvar_Set( "r_texturemode", "GL_LINEAR_MIPMAP_LINEAR" );
        trap_Cvar_SetValue( "r_texturefilter", (1<<(menuitem->curvalue-1) ));
    }
    else
    {
        trap_Cvar_Set( "r_texturemode", menuitem->curvalue ? "GL_LINEAR_MIPMAP_LINEAR" : "GL_LINEAR_MIPMAP_NEAREST" );
        trap_Cvar_SetValue( "r_texturefilter", 1 );
    }

    menuitem = UI_MenuItemByName( "m_performance_skymip" );
    if( menuitem->curvalue )
    {
        trap_Cvar_SetValue( "r_fastsky", 0 );
        trap_Cvar_SetValue( "r_skymip", 4 - menuitem->curvalue );
    }
    else
    {
        trap_Cvar_SetValue( "r_fastsky", 1 );
    }

    menuitem = UI_MenuItemByName( "m_performance_swapinterval" );
    trap_Cvar_SetValue( "r_swapinterval", menuitem->curvalue );

    menuitem = UI_MenuItemByName( "m_performance_LOD_slider" );
    trap_Cvar_SetValue( "r_subdivisions", (1<<(4 - menuitem->curvalue)) );
    trap_Cvar_SetValue( "r_lodbias", (menuitem->curvalue >= 2 ? 0 : 2-menuitem->curvalue) );

#if 0
    menuitem = UI_MenuItemByName( "m_performance_glsl" );
    trap_Cvar_SetValue( "gl_ext_GLSL", menuitem->curvalue );
#endif

    menuitem = UI_MenuItemByName( "m_performance_pplighting" );

    if( menuitem->curvalue )
        trap_Cvar_SetValue( "r_lighting_vertexlight", 0 );
    switch( menuitem->curvalue )
    {
    case 0:
        trap_Cvar_SetValue( "r_lighting_vertexlight", 1 );
        break;
    case 1:
        trap_Cvar_SetValue( "r_lighting_deluxemapping", 0 );
        break;
    case 2:
        trap_Cvar_SetValue( "r_lighting_deluxemapping", 1 );
        trap_Cvar_SetValue( "r_lighting_specular", 1 );
        break;
    case 3:
        trap_Cvar_SetValue( "r_lighting_deluxemapping", 1 );
        trap_Cvar_SetValue( "r_lighting_specular", 0 );
    }

    trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" );
}
Exemple #11
0
//=================
//TeamConfig_MenuDraw - skelmod
//=================
static void TeamConfig_MenuDraw( void )
{
	menucommon_t *playerbox;
	m_listitem_t *item;
	playermodelinfo_s *playermodel;
	int x, y, width, height, i;
	vec4_t tmpcolor;
	static int pmod_frame = -1, pmod_oldframe;

	Menu_Draw( &s_team_config_menu ); // draw menu on back

	// go for the model

	// if the color cvar is modified from outside of the ui (console), update the color vector
	if( color && color->modified )
		M_GetTeamColor();

	x = ( uis.vidWidth / 2 )+64;
	y = ( uis.vidHeight/2 - 128 );
	width = 256;
	height = 256;

	// now on the model.
	// First of all, see if we have to draw any model
	if( M_TeamHasModel() )
	{
		if( ( model && model->modified ) || ( skin && skin->modified ) )
		{
			M_GetTeamModel();
		}

		playerbox = UI_MenuItemByName( "m_TeamConfig_model" );
		if( playerbox && model->string[0] )
		{
			item = UI_FindItemInScrollListWithId( &playermodelsItemsList, playerbox->curvalue );
			if( item && item->data )
			{
				menucommon_t *skinitem = UI_MenuItemByName( "m_TeamConfig_skin" );
				playermodel = (playermodelinfo_s *)item->data;

				if( pmod_frame == -1 )
				{
					pmod_frame = pmod_oldframe = ui_playermodel_firstframe->integer;
				}
				if( UI_PlayerModelNextFrameTime() )
				{
					pmod_oldframe = pmod_frame;
					pmod_frame++;
					if( pmod_frame > ui_playermodel_lastframe->integer )
						pmod_frame = ui_playermodel_firstframe->integer;
				}

				// draw player model
				UI_DrawPlayerModel( playermodel->directory, skinitem->itemnames[skinitem->curvalue], playerColor, x+80, y-52, width, height, pmod_frame, pmod_oldframe );
			}
		}

	}
	else
	{
		if( hasForcedColorMenuItem->curvalue )
		{
			// draw colored square
			for( i = 0; i < 3; i++ )
				tmpcolor[i] = playerColor[i] * ( 1.0/255.0 );
			tmpcolor[3] = 1;
			trap_R_DrawStretchPic( x+160, y+40, width-128, height-128, 0, 0, 1, 1, tmpcolor, uis.whiteShader );
		}
	}
}