/*
=================
UI_CreateGame_GetMapsList
=================
*/
static void UI_CreateGame_GetMapsList( void )
{
	char *afile;

	if( !CHECK_MAP_LIST( FALSE ) || (afile = (char *)LOAD_FILE( "maps.lst", NULL )) == NULL )
	{
		uiCreateGame.done.generic.flags |= QMF_GRAYED;
		uiCreateGame.mapsList.itemNames = (const char **)uiCreateGame.mapsDescriptionPtr;
		Con_Printf( "Cmd_GetMapsList: can't open maps.lst\n" );
		return;
	}

	char *pfile = afile;
	char token[1024];
	int numMaps = 0;
	
	while(( pfile = COM_ParseFile( pfile, token )) != NULL )
	{
		if( numMaps >= UI_MAXGAMES ) break;
		StringConcat( uiCreateGame.mapName[numMaps], token, sizeof( uiCreateGame.mapName[0] ));
		StringConcat( uiCreateGame.mapsDescription[numMaps], token, MAPNAME_LENGTH );
		StringConcat( uiCreateGame.mapsDescription[numMaps], uiEmptyString, MAPNAME_LENGTH );
		if(( pfile = COM_ParseFile( pfile, token )) == NULL ) break; // unexpected end of file
		StringConcat( uiCreateGame.mapsDescription[numMaps], token, TITLE_LENGTH );
		StringConcat( uiCreateGame.mapsDescription[numMaps], uiEmptyString, TITLE_LENGTH );
		uiCreateGame.mapsDescriptionPtr[numMaps] = uiCreateGame.mapsDescription[numMaps];
		numMaps++;
	}

	if( !numMaps ) uiCreateGame.done.generic.flags |= QMF_GRAYED;

	for( ; numMaps < UI_MAXGAMES; numMaps++ ) uiCreateGame.mapsDescriptionPtr[numMaps] = NULL;
	uiCreateGame.mapsList.itemNames = (const char **)uiCreateGame.mapsDescriptionPtr;
	FREE_FILE( afile );
}
Beispiel #2
0
/*
=================
UI_Init
=================
*/
void UI_Init( void )
{
	// register our cvars and commands
	ui_precache = CVAR_REGISTER( "ui_precache", "0", FCVAR_ARCHIVE );
	ui_showmodels = CVAR_REGISTER( "ui_showmodels", "0", FCVAR_ARCHIVE );

	Cmd_AddCommand( "menu_main", UI_Main_Menu );
	Cmd_AddCommand( "menu_newgame", UI_NewGame_Menu );
	Cmd_AddCommand( "menu_loadgame", UI_LoadGame_Menu );
	Cmd_AddCommand( "menu_savegame", UI_SaveGame_Menu );
	Cmd_AddCommand( "menu_saveload", UI_SaveLoad_Menu );
	Cmd_AddCommand( "menu_multiplayer", UI_MultiPlayer_Menu );
	Cmd_AddCommand( "menu_options", UI_Options_Menu );
	Cmd_AddCommand( "menu_langame", UI_LanGame_Menu );
	Cmd_AddCommand( "menu_intenetgames", UI_InternetGames_Menu );
	Cmd_AddCommand( "menu_playersetup", UI_PlayerSetup_Menu );
	Cmd_AddCommand( "menu_controls", UI_Controls_Menu );
	Cmd_AddCommand( "menu_advcontrols", UI_AdvControls_Menu );
	Cmd_AddCommand( "menu_gameoptions", UI_GameOptions_Menu );
	Cmd_AddCommand( "menu_creategame", UI_CreateGame_Menu );
	Cmd_AddCommand( "menu_audio", UI_Audio_Menu );
	Cmd_AddCommand( "menu_video", UI_Video_Menu );
	Cmd_AddCommand( "menu_vidoptions", UI_VidOptions_Menu );
	Cmd_AddCommand( "menu_vidmodes", UI_VidModes_Menu );
	Cmd_AddCommand( "menu_customgame", UI_CustomGame_Menu );

	CHECK_MAP_LIST( TRUE );

	memset( uiEmptyString, ' ', sizeof( uiEmptyString ));	// HACKHACK
	uiStatic.initialized = true;

	// setup game info
	GetGameInfo( &gMenu.m_gameinfo );

	// load custom strings
	UI_LoadCustomStrings();

	//CR
	UI_InitTitleAnim();
}