/*
=================
UI_PlayerSetup_FindModels
=================
*/
static void UI_PlayerSetup_FindModels( void )
{
	char	name[256], path[256];
	char	**filenames;
	int	i, numFiles;
	
	uiPlayerSetup.num_models = 0;

	// Get file list
	filenames = FS_SEARCH(  "models/player/*", &numFiles, TRUE );
	if( !numFiles ) filenames = FS_SEARCH(  "models/player/*", &numFiles, FALSE ); 
#if 1
	// add default singleplayer model
	strcpy( uiPlayerSetup.models[uiPlayerSetup.num_models], "player" );
	uiPlayerSetup.num_models++;
#endif
	// build the model list
	for( i = 0; i < numFiles; i++ )
	{
		COM_FileBase( filenames[i], name );
		sprintf( path, "models/player/%s/%s.mdl", name, name );
		if( !FILE_EXISTS( path )) continue;

		strcpy( uiPlayerSetup.models[uiPlayerSetup.num_models], name );
		uiPlayerSetup.num_models++;
	}
}
Esempio n. 2
0
/*
=================
UI_LoadGame_GetGameList
=================
*/
static void UI_LoadGame_GetGameList( void )
{
	char	comment[256];
	char	**filenames;
	int	i, numFiles;

	filenames = FS_SEARCH( "save/*.sav", &numFiles, TRUE );

	// sort the saves in reverse order (oldest past at the end)
	qsort( filenames, numFiles, sizeof( char* ), (cmpfunc)COM_CompareSaves );

	for ( i = 0; i < numFiles; i++ )
	{
		if( i >= UI_MAXGAMES ) break;
		
		if( !GET_SAVE_COMMENT( filenames[i], comment ))
		{
			if( strlen( comment ))
			{
				// get name string even if not found - SV_GetComment can be mark saves
				// as <CORRUPTED> <OLD VERSION> etc
				StringConcat( uiLoadGame.saveDescription[i], uiEmptyString, TIME_LENGTH );
				StringConcat( uiLoadGame.saveDescription[i], comment, NAME_LENGTH );
				StringConcat( uiLoadGame.saveDescription[i], uiEmptyString, NAME_LENGTH );
				uiLoadGame.saveDescriptionPtr[i] = uiLoadGame.saveDescription[i];
				COM_FileBase( filenames[i], uiLoadGame.delName[i] );
			}
			else uiLoadGame.saveDescriptionPtr[i] = NULL;
			continue;
		}

		// strip path, leave only filename (empty slots doesn't have savename)
		COM_FileBase( filenames[i], uiLoadGame.saveName[i] );
		COM_FileBase( filenames[i], uiLoadGame.delName[i] );

		// fill save desc
		StringConcat( uiLoadGame.saveDescription[i], comment + CS_SIZE, TIME_LENGTH );
		StringConcat( uiLoadGame.saveDescription[i], " ", TIME_LENGTH );
		StringConcat( uiLoadGame.saveDescription[i], comment + CS_SIZE + CS_TIME, TIME_LENGTH );
		StringConcat( uiLoadGame.saveDescription[i], uiEmptyString, TIME_LENGTH ); // fill remaining entries
		StringConcat( uiLoadGame.saveDescription[i], comment, NAME_LENGTH );
		StringConcat( uiLoadGame.saveDescription[i], uiEmptyString, NAME_LENGTH );
		StringConcat( uiLoadGame.saveDescription[i], comment + CS_SIZE + (CS_TIME * 2), GAMETIME_LENGTH );
		StringConcat( uiLoadGame.saveDescription[i], uiEmptyString, GAMETIME_LENGTH );
		uiLoadGame.saveDescriptionPtr[i] = uiLoadGame.saveDescription[i];
	}

	for ( ; i < UI_MAXGAMES; i++ )
		uiLoadGame.saveDescriptionPtr[i] = NULL;

	uiLoadGame.savesList.itemNames = (const char **)uiLoadGame.saveDescriptionPtr;

	if ( strlen( uiLoadGame.saveName[0] ) == 0 )
		uiLoadGame.load.generic.flags |= QMF_GRAYED;
	else uiLoadGame.load.generic.flags &= ~QMF_GRAYED;

	if ( strlen( uiLoadGame.delName[0] ) == 0 )
		uiLoadGame.remove.generic.flags |= QMF_GRAYED;
	else uiLoadGame.remove.generic.flags &= ~QMF_GRAYED;
}
static void UI_FileDialog_GetFileList( void )
{
	char	**filenames;
	int	i = 0, numFiles, j, k;


	for( k = 0; k < uiFileDialogGlobal.npatterns; k++)
	{
		filenames = FS_SEARCH( uiFileDialogGlobal.patterns[k], &numFiles, TRUE );
		for ( j = 0; j < numFiles; i++, j++ )
		{
			if( i >= UI_MAXGAMES ) break;
			strcpy( uiFileDialog.filePath[i],filenames[j] );
			uiFileDialog.filePathPtr[i] = uiFileDialog.filePath[i];
		}
	}
	uiFileDialog.fileList.numItems = i;

	if( uiFileDialog.fileList.generic.charHeight )
	{
		uiFileDialog.fileList.numRows = (uiFileDialog.fileList.generic.height2 / uiFileDialog.fileList.generic.charHeight) - 2;
		if( uiFileDialog.fileList.numRows > uiFileDialog.fileList.numItems )
			uiFileDialog.fileList.numRows = i;
	}

	for ( ; i < UI_MAXGAMES; i++ )
		uiFileDialog.filePathPtr[i] = NULL;


	uiFileDialog.fileList.itemNames = (const char **)uiFileDialog.filePathPtr;
	uiFileDialog.image = PIC_Load( uiFileDialog.filePath[ uiFileDialog.fileList.curItem ] );
}
Esempio n. 4
0
/*
=================
UI_PlayDemo_GetDemoList
=================
*/
static void UI_PlayDemo_GetDemoList( void )
{
	char	comment[256];
	char	**filenames;
	int	i, numFiles;

	filenames = FS_SEARCH( "demos/*.dem", &numFiles, TRUE );

	for( i = 0; i < numFiles; i++ )
	{
		if( i >= UI_MAXGAMES ) break;
		
		if( !GET_DEMO_COMMENT( filenames[i], comment ))
		{
			if( strlen( comment ))
			{
				// get name string even if not found - CL_GetComment can be mark demos
				// as <CORRUPTED> <OLD VERSION> etc
				StringConcat( uiPlayDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH );
				StringConcat( uiPlayDemo.demoDescription[i], comment, MAPNAME_LENGTH );
				StringConcat( uiPlayDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
				uiPlayDemo.demoDescriptionPtr[i] = uiPlayDemo.demoDescription[i];
				COM_FileBase( filenames[i], uiPlayDemo.delName[i] );
			}
			else uiPlayDemo.demoDescriptionPtr[i] = NULL;
			continue;
		}

		// strip path, leave only filename (empty slots doesn't have savename)
		COM_FileBase( filenames[i], uiPlayDemo.demoName[i] );
		COM_FileBase( filenames[i], uiPlayDemo.delName[i] );

		// fill demo desc
		StringConcat( uiPlayDemo.demoDescription[i], comment + CS_SIZE, TITLE_LENGTH );
		StringConcat( uiPlayDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH );
		StringConcat( uiPlayDemo.demoDescription[i], comment, MAPNAME_LENGTH );
		StringConcat( uiPlayDemo.demoDescription[i], uiEmptyString, MAPNAME_LENGTH ); // fill remaining entries
		StringConcat( uiPlayDemo.demoDescription[i], comment + CS_SIZE * 2, MAXCLIENTS_LENGTH );
		StringConcat( uiPlayDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
		uiPlayDemo.demoDescriptionPtr[i] = uiPlayDemo.demoDescription[i];
	}

	for ( ; i < UI_MAXGAMES; i++ )
		uiPlayDemo.demoDescriptionPtr[i] = NULL;
	uiPlayDemo.demosList.itemNames = (const char **)uiPlayDemo.demoDescriptionPtr;

	if( strlen( uiPlayDemo.demoName[0] ) == 0 )
		uiPlayDemo.play.generic.flags |= QMF_GRAYED;
	else uiPlayDemo.play.generic.flags &= ~QMF_GRAYED;

	if( strlen( uiPlayDemo.delName[0] ) == 0 || !stricmp( gpGlobals->demoname, uiPlayDemo.delName[uiPlayDemo.demosList.curItem] ))
		uiPlayDemo.remove.generic.flags |= QMF_GRAYED;
	else uiPlayDemo.remove.generic.flags &= ~QMF_GRAYED;
}
Esempio n. 5
0
static void UI_PlayerSetup_FindSprayDecals( void )
{
	char	**filenames;
	int	numFiles;

	uiPlayerSetup.num_sprays = 0;

	// Get file list
	filenames = FS_SEARCH( "logos/*.bmp", &numFiles, FALSE );

	// build the spray list
	for( int i = 0; i < numFiles; i++ )
	{
		if( !FILE_EXISTS( filenames[i] )) continue;

		strcpy( uiPlayerSetup.sprays[uiPlayerSetup.num_sprays], filenames[i] );
		uiPlayerSetup.num_sprays++;
	}
}
Esempio n. 6
0
static void UI_TouchOptions_GetProfileList( void )
{
	char	**filenames;
	int	i = 0, numFiles, j = 0;
	char *curprofile;

	strncpy( uiTouchOptions.profileDesc[i], "Presets:", CS_SIZE );
	uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];
	i++;

	filenames = FS_SEARCH( "touch_presets/*.cfg", &numFiles, TRUE );
	for ( ; j < numFiles; i++, j++ )
	{
		if( i >= UI_MAXGAMES ) break;

		// strip path, leave only filename (empty slots doesn't have savename)
		COM_FileBase( filenames[j], uiTouchOptions.profileDesc[i] );
		uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];
	}

	// Overwrite "Presets:" line if there is no presets
	if( i == 1 )
		i = 0;

	filenames = FS_SEARCH( "touch_profiles/*.cfg", &numFiles, TRUE );
	j = 0;
	curprofile = CVAR_GET_STRING("touch_config_file");

	strncpy( uiTouchOptions.profileDesc[i], "Profiles:", CS_SIZE );
	uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];
	i++;

	strncpy( uiTouchOptions.profileDesc[i], "default", CS_SIZE );
	uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];

	uiTouchOptions.profiles.highlight = i;

	uiTouchOptions.firstProfile = i;
	i++;

	for ( ; j < numFiles; i++, j++ )
	{
		if( i >= UI_MAXGAMES ) break;

		COM_FileBase( filenames[j], uiTouchOptions.profileDesc[i] );
		uiTouchOptions.profileDescPtr[i] = uiTouchOptions.profileDesc[i];
		if( !strcmp( filenames[j], curprofile ) )
			uiTouchOptions.profiles.highlight = i;
	}
	uiTouchOptions.profiles.numItems = i;

	uiTouchOptions.remove.generic.flags |= QMF_GRAYED;
	uiTouchOptions.apply.generic.flags |= QMF_GRAYED;

	if( uiTouchOptions.profiles.generic.charHeight )
	{
		uiTouchOptions.profiles.numRows = (uiTouchOptions.profiles.generic.height2 / uiTouchOptions.profiles.generic.charHeight) - 2;
		if( uiTouchOptions.profiles.numRows > uiTouchOptions.profiles.numItems )
			uiTouchOptions.profiles.numRows = i;
	}

	for ( ; i < UI_MAXGAMES; i++ )
		uiTouchOptions.profileDescPtr[i] = NULL;
	uiTouchOptions.profiles.curItem = uiTouchOptions.profiles.highlight;


	uiTouchOptions.profiles.itemNames = (const char **)uiTouchOptions.profileDescPtr;
}
Esempio n. 7
0
/*
=================
UI_RecDemo_GetDemoList
=================
*/
static void UI_RecDemo_GetDemoList( void )
{
	char	comment[256];
	char	**filenames;
	int	i = 0, j, numFiles;

	filenames = FS_SEARCH( "demos/*.dem", &numFiles, TRUE );

	if ( CL_IsActive () && !gpGlobals->demorecording && !gpGlobals->demoplayback )
	{
		char maxClients[32];
		sprintf( maxClients, "%i", gpGlobals->maxClients );

		// create new entry for current save game
		strncpy( uiRecDemo.demoName[i], "new", CS_SIZE );
		StringConcat( uiRecDemo.demoDescription[i], gpGlobals->maptitle, TITLE_LENGTH );
		StringConcat( uiRecDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH ); // fill remaining entries
		StringConcat( uiRecDemo.demoDescription[i], "New Demo", MAPNAME_LENGTH );
		StringConcat( uiRecDemo.demoDescription[i], uiEmptyString, MAPNAME_LENGTH );
		StringConcat( uiRecDemo.demoDescription[i], maxClients, MAXCLIENTS_LENGTH );
		StringConcat( uiRecDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
		uiRecDemo.demoDescriptionPtr[i] = uiRecDemo.demoDescription[i];
		i++;
	}

	for( j = 0; j < numFiles; i++, j++ )
	{
		if( i >= UI_MAXGAMES ) break;
		
		if( !GET_DEMO_COMMENT( filenames[j], comment ))
		{
			if( strlen( comment ))
			{
				// get name string even if not found - C:_GetComment can be mark demos
				// as <CORRUPTED> <OLD VERSION> etc
				// get name string even if not found - SV_GetComment can be mark saves
				// as <CORRUPTED> <OLD VERSION> etc
				StringConcat( uiRecDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH );
				StringConcat( uiRecDemo.demoDescription[i], comment, MAPNAME_LENGTH );
				StringConcat( uiRecDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
				uiRecDemo.demoDescriptionPtr[i] = uiRecDemo.demoDescription[i];
				COM_FileBase( filenames[j], uiRecDemo.demoName[i] );
				COM_FileBase( filenames[j], uiRecDemo.delName[i] );
			}
			else uiRecDemo.demoDescriptionPtr[i] = NULL;
			continue;
		}

		// strip path, leave only filename (empty slots doesn't have demoname)
		COM_FileBase( filenames[j], uiRecDemo.demoName[i] );
		COM_FileBase( filenames[j], uiRecDemo.delName[i] );

		// fill demo desc
		StringConcat( uiRecDemo.demoDescription[i], comment + CS_SIZE, TITLE_LENGTH );
		StringConcat( uiRecDemo.demoDescription[i], uiEmptyString, TITLE_LENGTH );
		StringConcat( uiRecDemo.demoDescription[i], comment, MAPNAME_LENGTH );
		StringConcat( uiRecDemo.demoDescription[i], uiEmptyString, MAPNAME_LENGTH ); // fill remaining entries
		StringConcat( uiRecDemo.demoDescription[i], comment + CS_SIZE * 2, MAXCLIENTS_LENGTH );
		StringConcat( uiRecDemo.demoDescription[i], uiEmptyString, MAXCLIENTS_LENGTH );
		uiRecDemo.demoDescriptionPtr[i] = uiRecDemo.demoDescription[i];
	}

	for ( ; i < UI_MAXGAMES; i++ )
		uiRecDemo.demoDescriptionPtr[i] = NULL;
	uiRecDemo.demosList.itemNames = (const char **)uiRecDemo.demoDescriptionPtr;

	if( strlen( uiRecDemo.demoName[0] ) == 0 || !CL_IsActive () || gpGlobals->demoplayback )
		uiRecDemo.record.generic.flags |= QMF_GRAYED;
	else uiRecDemo.record.generic.flags &= ~QMF_GRAYED;

	if( strlen( uiRecDemo.delName[0] ) == 0 || !stricmp( gpGlobals->demoname, uiRecDemo.delName[uiRecDemo.demosList.curItem] ))
		uiRecDemo.remove.generic.flags |= QMF_GRAYED;
	else uiRecDemo.remove.generic.flags &= ~QMF_GRAYED;
}