Exemple #1
0
// switch between active teams
BOOL player_start_editor::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	int id;

	// select a team
	id = LOWORD(wParam);
	switch(id){
	case ID_TEAM_1:
		previous_team = selected_team; 
		selected_team = 0;
		reset_controls();
		break;

	case ID_TEAM_2:
		previous_team = selected_team; 
		selected_team = 1;
		reset_controls();
		break;	

	case ID_AUTOBALANCE:
		autobalance = !autobalance; 
		break;
	}	
	
	// low level stuff
	return CDialog::OnCommand(wParam, lParam);
}
// switch between active teams
BOOL player_start_editor::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	int id;

	// select a team
	id = LOWORD(wParam);
	switch(id){
	case ID_TEAM_1:
		selected_team = 0;
		reset_controls();
		break;

	case ID_TEAM_2:
		selected_team = 1;
		reset_controls();
		break;	
	}	
	
	// low level stuff
	return CDialog::OnCommand(wParam, lParam);
}
BOOL player_start_editor::OnInitDialog() 
{
	int i;
	int idx;	

	// initialize ship pool data
	memset(ship_pool, 0, sizeof(int) * MAX_TEAMS * MAX_SHIP_TYPES);
	for(i=0; i<MAX_TEAMS; i++){
		for(idx=0; idx<Team_data[i].number_choices; idx++){
			ship_pool[i][Team_data[i].ship_list[idx]] = Team_data[i].ship_count[idx];
		}
	}

	// initialize weapon pool data
	memset(weapon_pool, 0, sizeof(int) * MAX_TEAMS * MAX_WEAPON_TYPES);
	for(i=0; i<MAX_TEAMS; i++){
		for(idx=0; idx<MAX_WEAPON_TYPES; idx++){
			weapon_pool[i][idx] = Team_data[i].weaponry_pool[idx];
		}
	}

	// entry delay time
	m_delay = f2i(Entry_delay_time);

	// misc window crap
	CDialog::OnInitDialog();
	theApp.init_window(&Player_wnd_data, this);
	m_spin1.SetRange(0, 99);
	m_pool_spin.SetRange(0, 9999);
	m_delay_spin.SetRange(0, 30);	

	// regenerate all the controls
	reset_controls();

	dlg_inited = 1;

	return TRUE;
}
Exemple #4
0
BOOL player_start_editor::OnInitDialog() 
{
	int i, j;
	int idx;	

	// initialize ship pool data
	memset(static_ship_pool, -1, sizeof(int) * MAX_TVT_TEAMS * MAX_SHIP_CLASSES);
	memset(dynamic_ship_pool, -1, sizeof(int) * MAX_TVT_TEAMS * MAX_SEXP_VARIABLES);
	memset(static_ship_variable_pool, -1, sizeof(int) * MAX_TVT_TEAMS * MAX_SHIP_CLASSES);
	memset(dynamic_ship_variable_pool, -1, sizeof(int) * MAX_TVT_TEAMS * MAX_SEXP_VARIABLES);
	for(i=0; i<MAX_TVT_TEAMS; i++){
		for(idx=0; idx<Team_data[i].num_ship_choices; idx++)
		{
			// do we have a variable for this entry? if we don't....
			if (Team_data[i].ship_list_variables[idx] == -1)
			{
				// This pool is set to hold the number of ships available at an index corresponding to the Ship_info array.
				static_ship_pool[i][Team_data[i].ship_list[idx]] = Team_data[i].ship_count[idx];
				// This pool is set to hold whether a ship at a Ship_info index has been set by a variable (and the 
				// variables index in Sexp_variables) if it has).
				static_ship_variable_pool[i][Team_data[i].ship_list[idx]] = Team_data[i].ship_count_variables[idx];
			}
			// if we do....
			else
			{
				// This pool is set to hold the number of ships available at an index corresponding to the Sexp_variables array
				dynamic_ship_pool[i][Team_data[i].ship_list_variables[idx]] = Team_data[i].ship_count[idx];
				// This pool is set to hold whether a ship at a Ship_info index has been set by a variable (and the 
				// variables index in Sexp_variables) if it has).
				dynamic_ship_variable_pool[i][Team_data[i].ship_list_variables[idx]] = Team_data[i].ship_count_variables[idx];
			}
		}
	}

	
	// initialize weapon pool data
	memset(static_weapon_pool, -1, sizeof(int) * MAX_TVT_TEAMS * MAX_WEAPON_TYPES);
	memset(dynamic_weapon_pool, -1, sizeof(int) * MAX_TVT_TEAMS * MAX_SEXP_VARIABLES);
	memset(static_weapon_variable_pool, -1, sizeof(int) * MAX_TVT_TEAMS * MAX_WEAPON_TYPES);
	memset(dynamic_weapon_variable_pool, -1, sizeof(int) * MAX_TVT_TEAMS * MAX_SEXP_VARIABLES);
	for(i=0; i<MAX_TVT_TEAMS; i++){
		for(idx=0; idx<Team_data[i].num_weapon_choices; idx++)
		{
			// do we have a variable for this entry?
			if (Team_data[i].weaponry_pool_variable[idx] == -1)
			{
				static_weapon_pool[i][Team_data[i].weaponry_pool[idx]] = Team_data[i].weaponry_count[idx];
				static_weapon_variable_pool[i][Team_data[i].weaponry_pool[idx]] = Team_data[i].weaponry_amount_variable[idx];
			}
			// if we do....
			else
			{
				dynamic_weapon_pool[i][Team_data[i].weaponry_pool_variable[idx]] = Team_data[i].weaponry_count[idx];
				dynamic_weapon_variable_pool[i][Team_data[i].weaponry_pool_variable[idx]] = Team_data[i].weaponry_amount_variable[idx];
			}
		}
	}

	// initialise the ship and weapon usage list
	memset(ship_usage, 0, sizeof(int) * MAX_TVT_TEAMS * MAX_SHIP_CLASSES);
	memset(weapon_usage, 0, sizeof(int) * MAX_TVT_TEAMS * MAX_WEAPON_TYPES);


	if (The_mission.game_type & MISSION_TYPE_MULTI_TEAMS) { 
		for (i=0; i<MAX_TVT_TEAMS; i++) {
			for (j=0; j<MAX_TVT_WINGS_PER_TEAM; j++) {
				generate_ship_usage_list(ship_usage[i], TVT_wings[(i*MAX_TVT_WINGS_PER_TEAM) + j]);
				generate_weaponry_usage_list(weapon_usage[i], TVT_wings[(i*MAX_TVT_WINGS_PER_TEAM) + j]);
			}			
		}
	}
	else {
		for (i=0; i<MAX_STARTING_WINGS; i++) {
			generate_ship_usage_list(ship_usage[0], Starting_wings[i]);
			generate_weaponry_usage_list(weapon_usage[0], Starting_wings[i]);
		}
	}	

	// entry delay time
	m_delay = f2i(Entry_delay_time);

	// misc window crap
	CDialog::OnInitDialog();
	theApp.init_window(&Player_wnd_data, this);
	m_spin1.SetRange(0, 99);
	m_pool_spin.SetRange(0, 9999);
	m_delay_spin.SetRange(0, 30);	

	// regenerate all the controls
	reset_controls();

	dlg_inited = 1;

	return TRUE;
}