void ShipSpecialDamage::OnEnableSpecialExp() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	DoGray();
}
void ShipSpecialHitpoints::OnEnableSpecialShieldpoints() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	DoGray();
}
void ShipSpecialDamage::OnEnableShockwave() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	// enable/disable shock speed
	DoGray();}
BOOL ShipSpecialDamage::OnInitDialog() 
{
	
	// TODO: Add extra initialization here

	// get ship num
	object *objp;

	m_ship_num = -1;

	objp = GET_FIRST(&obj_used_list);
	while (objp != END_OF_LIST(&obj_used_list)) {
		if ((objp->type == OBJ_START) || (objp->type == OBJ_SHIP)) {
			if (objp->flags & OF_MARKED) {

				m_ship_num = objp->instance;
				break;
			}
		}
		objp = GET_NEXT(objp);
	}

	if (Ships[m_ship_num].special_exp_index == -1) {
		// get default_table_values
		ship_info *sip;
		sip = &Ship_info[Ships[m_ship_num].ship_info_index];

		m_inner_rad = (int)sip->inner_rad;
		m_outer_rad = (int)sip->outer_rad;
		m_damage = (int) sip->damage;
		m_blast = (int) sip->blast;
		m_shock_enabled = (int) sip->explosion_propagates;
		m_shock_speed = (int) sip->shockwave_speed;
		m_special_exp_enabled = FALSE;

		if (m_inner_rad < 10) m_inner_rad = 10;
		if (m_outer_rad < 11) m_outer_rad = 11;
		if (m_shock_speed < 10) m_shock_speed = 10;
	} else {
		int index = Ships[m_ship_num].special_exp_index;
		Assert( (index > 0) && (index < MAX_SEXP_VARIABLES-5) );

		m_inner_rad = atoi(Sexp_variables[index++].text);
		m_outer_rad = atoi(Sexp_variables[index++].text);
		m_damage = atoi(Sexp_variables[index++].text);
		m_blast = atoi(Sexp_variables[index++].text);
		m_shock_enabled = atoi(Sexp_variables[index++].text);
		m_shock_speed = atoi(Sexp_variables[index++].text);
		m_special_exp_enabled = TRUE;
	}

	CDialog::OnInitDialog();

	// maybe gray out lots of stuff
	DoGray();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void ShipSpecialDamage::OnEnableDeathrollTime()
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);

	// set delay
	m_duration = m_duration_enabled ? 2 : 0;
	UpdateData(FALSE);

	// enable/disable deathroll time
	DoGray();
}
BOOL ShipSpecialHitpoints::OnInitDialog() 
{
	// get ship num
	object *objp;

	m_ship_num = -1;

	objp = GET_FIRST(&obj_used_list);
	while (objp != END_OF_LIST(&obj_used_list)) {
		if ((objp->type == OBJ_START) || (objp->type == OBJ_SHIP)) {
			if (objp->flags & OF_MARKED) {

				m_ship_num = objp->instance;
				break;
			}
		}
		objp = GET_NEXT(objp);
	}

	if (Ships[m_ship_num].special_hitpoint_index == -1)
	{
		// get default_table_values
		ship_info *sip;
		sip = &Ship_info[Ships[m_ship_num].ship_info_index];

		m_shields = (int)sip->initial_shield_strength;
		m_hull = (int)sip->initial_hull_strength;
		m_special_hitpoints_enabled = FALSE;

		if (m_shields < 0) m_shields = 0;
		if (m_hull < 10) m_hull = 10;
	} else {
		int index = Ships[m_ship_num].special_hitpoint_index;
//		Assert( (index > 0) && (index < MAX_SEXP_VARIABLES-(BLOCK_HITPOINT_SIZE-1)) );

		m_shields = atoi(Sexp_variables[index++].text);
		m_hull = atoi(Sexp_variables[index++].text);

		m_special_hitpoints_enabled = TRUE;
	}

	CDialog::OnInitDialog();

	// maybe gray out lots of stuff
	DoGray();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL ShipSpecialHitpoints::OnInitDialog() 
{
	// get ship num
	object *objp;

	num_selected_ships = 0;

	objp = GET_FIRST(&obj_used_list);
	while (objp != END_OF_LIST(&obj_used_list)) {
		if ((objp->type == OBJ_START) || (objp->type == OBJ_SHIP)) {
			if (objp->flags & OF_MARKED) {
				m_selected_ships[num_selected_ships] = objp->instance;
				num_selected_ships++;
			}
		}
		objp = GET_NEXT(objp);
	}

	Assert(num_selected_ships);
	Assert (Objects[cur_object_index].flags & OF_MARKED);
	m_ship_num = Objects[cur_object_index].instance; 

	// get the details from the first ship
	//hull
	if (Ships[m_ship_num].special_hitpoints) {
		m_hull = Ships[m_ship_num].special_hitpoints;
		m_special_hitpoints_enabled = TRUE;
	}
	else {
		// get default_table_values
		ship_info *sip;
		sip = &Ship_info[Ships[m_ship_num].ship_info_index];

		m_hull = (int)sip->max_hull_strength;
		m_special_hitpoints_enabled = FALSE;

		if (m_hull < 1) m_hull = 10;
	}

	//shields
	if (Ships[m_ship_num].special_shield > 0){
		m_shields = Ships[m_ship_num].special_shield;
		m_special_shield_enabled = TRUE;
	}
	else {
		// get default_table_values
		ship_info *sip;
		sip = &Ship_info[Ships[m_ship_num].ship_info_index];

		m_shields = (int)sip->max_shield_strength;
		m_special_shield_enabled = FALSE;

		if (m_shields < 0) {
			m_shields = 0;
		}
	} 

	CDialog::OnInitDialog();

	// maybe gray out lots of stuff
	DoGray();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
BOOL ShipSpecialDamage::OnInitDialog() 
{
	
	// TODO: Add extra initialization here

	// get ship num
	object *objp;

	num_selected_ships = 0;

	objp = GET_FIRST(&obj_used_list);
	while (objp != END_OF_LIST(&obj_used_list)) {
		if ((objp->type == OBJ_START) || (objp->type == OBJ_SHIP)) {
			if (objp->flags & OF_MARKED) {
				m_selected_ships[num_selected_ships] = objp->instance;
				num_selected_ships++;
			}
		}
		objp = GET_NEXT(objp);
	}

	Assert (Objects[cur_object_index].flags & OF_MARKED);
	m_ship_num = Objects[cur_object_index].instance;

	if (!(Ships[m_ship_num].use_special_explosion)) {
		// get default_table_values
		ship_info *sip;
		sip = &Ship_info[Ships[m_ship_num].ship_info_index];

		m_inner_rad = (int)sip->shockwave.inner_rad;
		m_outer_rad = (int)sip->shockwave.outer_rad;
		m_damage = (int) sip->shockwave.damage;
		m_blast = (int) sip->shockwave.blast;
		m_shock_enabled = (int) sip->explosion_propagates;
		m_shock_speed = (int) sip->shockwave.speed;
		m_duration_enabled = FALSE;
		m_duration = 0;
		m_special_exp_enabled = FALSE;

		if (m_inner_rad < 1) {
			m_inner_rad = 1;
		}
		if (m_outer_rad < 2) {
			m_outer_rad = 2;
		}
		if (m_shock_speed < 1) {
			m_shock_speed = 1;
		}
	}
	else {
		m_inner_rad = Ships[m_ship_num].special_exp_inner;
		m_outer_rad = Ships[m_ship_num].special_exp_outer;
		m_damage = Ships[m_ship_num].special_exp_damage;
		m_blast = Ships[m_ship_num].special_exp_blast;
		m_shock_enabled = Ships[m_ship_num].use_shockwave;
		m_shock_speed = Ships[m_ship_num].special_exp_shockwave_speed;
		m_duration_enabled = (Ships[m_ship_num].special_exp_deathroll_time > 0);
		m_duration = Ships[m_ship_num].special_exp_deathroll_time;
		m_special_exp_enabled = TRUE;
	}


	CDialog::OnInitDialog();

	// maybe gray out lots of stuff
	DoGray();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}