Ejemplo n.º 1
0
void pilot_manage_init_player_stuff(int mode)
{
	// determine if we should be looking for single or multiplayers at the outset
	Player_sel_mode = mode;
	
	// get the list of pilots based upon whether we're in single or multiplayer mode
	Num_pilots = 0;
	Get_file_list_filter = pilot_manage_pilot_filter;

	// single player specific stuff
	if (mode == PLAYER_SELECT_MODE_SINGLE) {
		Num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_SINGLE_PLAYERS, NOX("*.plr"), CF_SORT_TIME);
	}
	// multiplayer specific stuff
	else {
		Num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_MULTI_PLAYERS, NOX("*.plr"), CF_SORT_TIME);
	}

	int ranks[MAX_PILOTS];

	int i;
	for (i=0; i<Num_pilots; i++) {
		int j;
		for (j=0; j<Num_pilots; j++) {
			if (!strcmp(Pilots[i], Pilots_arr[j])) {
				ranks[i] = Pilot_ranks[j];
				break;
			}
		}
		Assert(j < Num_pilots);  // Pilot not found?  How is that possible?
	}

	for (i=0; i<Num_pilots; i++) {
		Pilot_ranks[i] = ranks[i];
	}

	 List_scroll_offset = 0;
	 
	Selected_line = 0;
	// select whatever pilot was highlighted before switching modes
	if (mode == PLAYER_SELECT_MODE_SINGLE && prev_single_player > -1) {
		Selected_line = prev_single_player;
	} else if (mode == PLAYER_SELECT_MODE_MULTI && prev_multi_player > -1) {
		Selected_line = prev_multi_player;
	} else {
	 // first time in select pilot from reg desk		
	for(int idx=0;idx<Num_pilots;idx++){
		if(strcmp(Player->callsign, Pilots_arr[idx])==0){
			Selected_line = idx;
			break;
		}
	} 
	}
	 
	pilot_manage_new_pilot_selected();

}
Ejemplo n.º 2
0
void barracks_init_player_stuff(int mode)
{
	int i, j;

	// determine if we should be looking for single or multiplayers at the outset
	Player_sel_mode = mode;
	
	// single player specific stuff
	if (mode == PLAYER_SELECT_MODE_SINGLE) {
		Game_mode &= ~GM_MULTIPLAYER;
		Game_mode |= GM_NORMAL;

		// disable squad logo switching		
		Buttons[gr_screen.res][B_SQUAD_PREV_BUTTON].button.hide();
		Buttons[gr_screen.res][B_SQUAD_PREV_BUTTON].button.disable();
		Buttons[gr_screen.res][B_SQUAD_PREV_BUTTON].button.set_disabled_action(barracks_squad_change_popup);
		Buttons[gr_screen.res][B_SQUAD_NEXT_BUTTON].button.hide();
		Buttons[gr_screen.res][B_SQUAD_NEXT_BUTTON].button.disable();			
		Buttons[gr_screen.res][B_SQUAD_NEXT_BUTTON].button.set_disabled_action(barracks_squad_change_popup);
	}
	// multiplayer specific stuff
	else if (mode == PLAYER_SELECT_MODE_MULTI) {
		Game_mode &= ~GM_NORMAL;
		Game_mode |= GM_MULTIPLAYER;

		// enable squad logo switching
		Buttons[gr_screen.res][B_SQUAD_PREV_BUTTON].button.enable();
		Buttons[gr_screen.res][B_SQUAD_PREV_BUTTON].button.unhide();
		Buttons[gr_screen.res][B_SQUAD_NEXT_BUTTON].button.enable();
		Buttons[gr_screen.res][B_SQUAD_NEXT_BUTTON].button.unhide();			
	}

	// get the list of pilots based upon whether we're in single or multiplayer mode
	// moved down here so pilotfile::verify knows which Game_mode to get ranks for
	Num_pilots = 0;
	Get_file_list_filter = barracks_pilot_filter;

	Num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_PLAYERS, NOX("*.plr"), CF_SORT_TIME);

	int ranks[MAX_PILOTS];

	for (i=0; i<Num_pilots; i++) {
		for (j=0; j<Num_pilots; j++) {
			if (!strcmp(Pilots[i], Pilots_arr[j])) {
				ranks[i] = Pilot_ranks[j];
				break;
			}
		}
		Assert(j < Num_pilots);  // Pilot not found?  How is that possible?
	}

	for (i=0; i<Num_pilots; i++) {
		Pilot_ranks[i] = ranks[i];
	}

	Selected_line = List_scroll_offset = 0;
	barracks_new_pilot_selected();

}
Ejemplo n.º 3
0
// load up the list of pilot squad filenames
void pilot_load_squad_pic_list()
{
	Num_pilot_squad_images = 0;
	
	// load pilot images from the player images directory
	Num_pilot_squad_images = cf_get_file_list_preallocated(MAX_PILOT_IMAGES, Pilot_squad_images_arr, Pilot_squad_image_names, CF_TYPE_SQUAD_IMAGES, NOX("*.pcx"));

	// sort all filenames
	cf_sort_filenames(Num_pilot_squad_images, Pilot_squad_image_names, CF_SORT_NAME);
}
Ejemplo n.º 4
0
void player_select_init_player_stuff(int mode)
{
	Player_select_list_start = 0;

	// set the select mode to single player for default
	Player_select_mode = mode;

	// load up the list of players based upon the Player_select_mode (single or multiplayer)
	Get_file_list_filter = player_select_pilot_file_filter;

	Player_select_num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_PLAYERS, NOX("*.plr"), CF_SORT_TIME);

	// if we have a "last_player", and they're in the list, bash them to the top of the list
	if (Player_select_last_pilot[0] != '\0') {
		int i,j;
		for (i = 0; i < Player_select_num_pilots; ++i) {
			if (!stricmp(Player_select_last_pilot,Pilots[i])) {
				break;
			}
		}
		if (i != Player_select_num_pilots) {
			for (j = i; j > 0; --j) {
				strncpy(Pilots[j], Pilots[j-1], strlen(Pilots[j-1])+1);
			}
			strncpy(Pilots[0], Player_select_last_pilot, strlen(Player_select_last_pilot)+1);
		}
	}

	Player = NULL;

	// if this value is -1, it means we should set it to the num pilots count
	if (Player_select_initial_count == -1) {
		Player_select_initial_count = Player_select_num_pilots;
	}

	// select the first pilot if any exist, otherwise set to -1
	if (Player_select_num_pilots == 0) {
		Player_select_pilot = -1;
		player_select_set_middle_text(XSTR( "Type Callsign and Press Enter", 381));
		player_select_set_controls(1);		// gray out the controls
		player_select_create_new_pilot();
	} else {
		Player_select_pilot = 0;
	}
}
void campaign_filelist_box::initialize()
{
	int i, z, num_files;
	char *mission_filenames[2000];
	char mission_filenames_arr[2000][MAX_FILENAME_LEN];
	mission a_mission;

	ResetContent();

	extern int Skip_packfile_search;
	Skip_packfile_search = 1;
	num_files = cf_get_file_list_preallocated(2000, mission_filenames_arr, mission_filenames, CF_TYPE_MISSIONS, "*.fs2");
	Skip_packfile_search = 0;

	i=0;

	while (i < num_files)
	{
		// make a call to get the mission info for this mission.  Passing a misison as the second
		// parameter will prevent The_mission from getting overwritten.
		get_mission_info( mission_filenames[i] , &a_mission );
		strcat(mission_filenames[i],".fs2");

		// only add missions of the appropriate type to the file listbox
		if ( (Campaign.type == CAMPAIGN_TYPE_SINGLE) && (a_mission.game_type & (MISSION_TYPE_SINGLE|MISSION_TYPE_TRAINING)) )
			AddString(mission_filenames[i]);
		else if ( (Campaign.type == CAMPAIGN_TYPE_MULTI_COOP) && (a_mission.game_type & MISSION_TYPE_MULTI_COOP) )
			AddString(mission_filenames[i]);
		else if ( (Campaign.type == CAMPAIGN_TYPE_MULTI_TEAMS) && (a_mission.game_type & MISSION_TYPE_MULTI_TEAMS) )
			AddString(mission_filenames[i]);

		i++;
	} 
	

	for (i=0; i<Campaign.num_missions; i++) {
		z = FindString(-1, Campaign.missions[i].name);
		if (z != LB_ERR) {
			DeleteString(z);  // take out all missions already in the campaign
			i--;  // recheck for name just in case there are two (should be impossible but can't be sure)
		}
	}
	
}
Ejemplo n.º 6
0
int player_select_get_last_pilot()
{
	// if the player has the Cmdline_use_last_pilot command line option set, try and drop out quickly
	if (Cmdline_use_last_pilot) {
		int idx;

		if ( !player_select_get_last_pilot_info() ) {
			return 0;
		}

		Get_file_list_filter = player_select_pilot_file_filter;

		Player_select_num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_PLAYERS, NOX("*.plr"), CF_SORT_TIME);

		Player_select_pilot = -1;
		idx = 0;
		// pick the last player
		for (idx=0;idx<Player_select_num_pilots;idx++) {
			if (strcmp(Player_select_last_pilot,Pilots_arr[idx])==0) {
				Player_select_pilot = idx;
				break;
			}
		}

		// set this so that we don't incorrectly create a "blank" pilot - .plr
		// in the player_select_close() function
		Player_select_num_pilots = 0;

		// if we've actually found a valid pilot, load him up
		if (Player_select_pilot != -1) {
			Player = &Players[0];
			Pilot.load_player(Pilots_arr[idx], Player);
			Player->flags |= PLAYER_FLAGS_STRUCTURE_IN_USE;
			return 1;
		}
	}

	return 0;
}