void campaign_editor::update_loop_desc_window()
{
	bool enable_loop_desc_window;

	enable_loop_desc_window = false;
	if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_loop) {
		enable_loop_desc_window = true;
	}

	// maybe enable description window
	GetDlgItem(IDC_MISSISON_LOOP_DESC)->EnableWindow(enable_loop_desc_window);
	GetDlgItem(IDC_LOOP_BRIEF_ANIM)->EnableWindow(enable_loop_desc_window);
	GetDlgItem(IDC_LOOP_BRIEF_SOUND)->EnableWindow(enable_loop_desc_window);
	GetDlgItem(IDC_LOOP_BRIEF_BROWSE)->EnableWindow(enable_loop_desc_window);
	GetDlgItem(IDC_LOOP_BRIEF_SOUND_BROWSE)->EnableWindow(enable_loop_desc_window);

	// set new text
	if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_loop_txt && enable_loop_desc_window) {
		m_loop_desc = convert_multiline_string(Links[Cur_campaign_link].mission_loop_txt);		
	} else {
		m_loop_desc = _T("");
	}

	// set new text
	if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_loop_brief_anim && enable_loop_desc_window) {
		m_loop_brief_anim = convert_multiline_string(Links[Cur_campaign_link].mission_loop_brief_anim);		
	} else {
		m_loop_brief_anim = _T("");
	}

	// set new text
	if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_loop_brief_sound && enable_loop_desc_window) {
		m_loop_brief_sound = convert_multiline_string(Links[Cur_campaign_link].mission_loop_brief_sound);
	} else {
		m_loop_brief_sound = _T("");
	}

	// reset text
	UpdateData(FALSE);
}
void campaign_editor::initialize( int init_files )
{
	Cur_campaign_mission = Cur_campaign_link = -1;
	m_tree.setup((CEdit *) GetDlgItem(IDC_HELP_BOX));
	load_tree(0);
	Campaign_tree_viewp->initialize();

	// only initialize the file dialog box when the parameter says to.  This should
	// only happen when a campaign type changes
	if ( init_files ){
		m_filelist.initialize();
	}

	m_name = Campaign.name;
	m_type = Campaign.type;
	m_num_players.Format("%d", Campaign.num_players);

	if (Campaign.desc) {
		convert_multiline_string(m_desc, Campaign.desc);
	} else {
		m_desc = _T("");
	}

	m_branch_desc = _T("");

	m_branch_brief_anim = _T("");	
	m_branch_brief_sound = _T("");	

	// single player should hide the two dialog items about number of players allowed
	if ( m_type == CAMPAIGN_TYPE_SINGLE ) {
		GetDlgItem(IDC_NUM_PLAYERS)->ShowWindow( SW_HIDE );
		GetDlgItem(IDC_PLAYERS_LABEL)->ShowWindow( SW_HIDE );
	} else {
		GetDlgItem(IDC_NUM_PLAYERS)->ShowWindow( SW_SHOW );
		GetDlgItem(IDC_PLAYERS_LABEL)->ShowWindow( SW_SHOW );
	}

	// set up the tech db checkbox
	m_custom_tech_db = (BOOL)(Campaign.flags & CF_CUSTOM_TECH_DATABASE);

	UpdateData(FALSE);
}
示例#3
0
void campaign_tree_view::OnLButtonDown(UINT nFlags, CPoint point) 
{
	int i;
	CString str;
	CEdit *box;
	CListBox *listbox;
	CClientDC dc(this);

	OnPrepareDC(&dc);
	dc.DPtoLP(&point);
	if (nFlags & MK_CONTROL) {
		listbox = (CListBox *) &Campaign_tree_formp->m_filelist;
		i = listbox->GetCurSel();

		Mission_dropping = -1;
		if (i != LB_ERR) {
			Mission_dropping = i;
			SetCapture();
		}

		Last_draw_size = CSize(0, 0);
		Dragging_rect.SetRect(0, 0, 1, 1);
		dc.DrawDragRect(Dragging_rect, Last_draw_size, NULL, CSize(0, 0));

	} else {
		if ( (Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_loop) {
			// HACK!!  UPDATE mission loop desc before changing selections
			// save mission loop desc
			char buffer[MISSION_DESC_LENGTH];
			box = (CEdit *) Campaign_tree_formp->GetDlgItem(IDC_MISSISON_LOOP_DESC);
			box->GetWindowText(buffer, MISSION_DESC_LENGTH);
			if (strlen(buffer)) {
				if (Links[Cur_campaign_link].mission_loop_txt) {
					free(Links[Cur_campaign_link].mission_loop_txt);
				}
				Links[Cur_campaign_link].mission_loop_txt = strdup(buffer);
			} else {
				Links[Cur_campaign_link].mission_loop_txt = NULL;
			}

			// HACK!!  UPDATE mission loop desc before changing selections
			// save mission loop desc			
			box = (CEdit *) Campaign_tree_formp->GetDlgItem(IDC_LOOP_BRIEF_ANIM);
			box->GetWindowText(buffer, MISSION_DESC_LENGTH);
			if (strlen(buffer)) {
				if (Links[Cur_campaign_link].mission_loop_brief_anim) {
					free(Links[Cur_campaign_link].mission_loop_brief_anim);
				}
				Links[Cur_campaign_link].mission_loop_brief_anim = strdup(buffer);
			} else {
				Links[Cur_campaign_link].mission_loop_brief_anim = NULL;
			}

			// HACK!!  UPDATE mission loop desc before changing selections
			// save mission loop desc			
			box = (CEdit *) Campaign_tree_formp->GetDlgItem(IDC_LOOP_BRIEF_SOUND);
			box->GetWindowText(buffer, MISSION_DESC_LENGTH);
			if (strlen(buffer)) {
				if (Links[Cur_campaign_link].mission_loop_brief_sound) {
					free(Links[Cur_campaign_link].mission_loop_brief_sound);
				}
				Links[Cur_campaign_link].mission_loop_brief_sound = strdup(buffer);
			} else {
				Links[Cur_campaign_link].mission_loop_brief_sound = NULL;
			}
		}
		Mission_dragging = Cur_campaign_mission = Cur_campaign_link = -1;
		for (i=0; i<Campaign.num_missions; i++)
			if (Elements[i].box.PtInRect(point)) {
				SetCapture();

				Mission_dragging = Cur_campaign_mission = i;
				Dragging_rect = Elements[i].box;
				Rect_offset = Dragging_rect.TopLeft() - point;
				Last_draw_size = CSize(4, 4);
				if (Campaign.missions[Cur_campaign_mission].num_goals < 0)  // haven't loaded goal names yet (or notes)
					read_mission_goal_list(Cur_campaign_mission);

				if (Campaign.missions[Cur_campaign_mission].notes) {
					str = convert_multiline_string(Campaign.missions[Cur_campaign_mission].notes);
					box = (CEdit *) Campaign_tree_formp->GetDlgItem(IDC_HELP_BOX);
					if (box)
						box->SetWindowText(str);
				}

				Campaign_tree_formp->mission_selected(Cur_campaign_mission);
				break;
			}
	}
	
	Invalidate();
	UpdateWindow();
	Campaign_tree_formp->load_tree();
	if (Mission_dragging != -1) {
		CRect rect = Dragging_rect;

		dc.LPtoDP(&rect);
		dc.DrawDragRect(rect, Last_draw_size, NULL, CSize(0, 0));
	}

	CScrollView::OnLButtonDown(nFlags, point);
}
void debriefing_editor_dlg::update_data(int update)
{
	int enable, save_debriefing;
	debrief_stage *ptr;

	save_debriefing = m_current_debriefing;

	if (update)
		UpdateData(TRUE);

	// based on the game type, enable the multiple briefings combo box (or disable it)

	// set up the pointer to the briefing that we are editing
	if ( save_debriefing != m_current_debriefing )
		Debriefing = &Debriefings[save_debriefing];
	else
		Debriefing = &Debriefings[m_current_debriefing];

	if (m_last_stage >= 0) {
		ptr = &Debriefing->stages[m_last_stage];
		if (ptr->formula >= 0)
			free_sexp2(ptr->formula);

		ptr->formula = m_tree.save_tree();
		deconvert_multiline_string(ptr->new_text, m_text, MAX_DEBRIEF_LEN);
		deconvert_multiline_string(ptr->new_recommendation_text, m_rec_text, MAX_RECOMMENDATION_LEN);
		string_copy(ptr->voice, m_voice, MAX_FILENAME_LEN);
	}

	// now get new stage data
	if ((m_cur_stage >= 0) && (m_cur_stage < Debriefing->num_stages)) {
		ptr = &Debriefing->stages[m_cur_stage];
		m_stage_title.Format("Stage %d of %d", m_cur_stage + 1, Debriefing->num_stages);
		m_tree.load_tree(ptr->formula);
		m_text = convert_multiline_string(ptr->new_text);
		m_rec_text = convert_multiline_string(ptr->new_recommendation_text);
		m_voice = ptr->voice;
		enable = TRUE;

	} else {
		m_stage_title = _T("No stages");
		m_tree.clear_tree();
		m_text = _T("");
		m_rec_text = _T("");
		m_voice = _T("");
		enable = FALSE;
		m_cur_stage = -1;
	}

	if (m_cur_stage == Debriefing->num_stages - 1)
		GetDlgItem(IDC_NEXT) -> EnableWindow(FALSE);
	else
		GetDlgItem(IDC_NEXT) -> EnableWindow(enable);

	if (m_cur_stage)
		GetDlgItem(IDC_PREV) -> EnableWindow(enable);
	else
		GetDlgItem(IDC_PREV) -> EnableWindow(FALSE);

	if (Debriefing->num_stages >= MAX_DEBRIEF_STAGES)
		GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(FALSE);
	else
		GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(TRUE);

	if (Debriefing->num_stages) {
		GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(enable);
		GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(enable);

	} else {
		GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(FALSE);
		GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(FALSE);
	}

	GetDlgItem(IDC_VOICE) -> EnableWindow(enable);
	GetDlgItem(IDC_BROWSE) -> EnableWindow(enable);
	GetDlgItem(IDC_TEXT) -> EnableWindow(enable);
	GetDlgItem(IDC_REC_TEXT) -> EnableWindow(enable);
	GetDlgItem(IDC_TREE) -> EnableWindow(enable);

	m_last_stage = m_cur_stage;
	UpdateData(FALSE);

	#ifndef NDEBUG
	count_free_sexp_nodes();
	#endif
}
void briefing_editor_dlg::update_data(int update)
{
	char buf[MAX_LABEL_LEN], buf2[MAX_ICON_TEXT_LEN], buf3[MAX_BRIEF_LEN];
	int i, j, l, lines, count, enable = TRUE, valid = 0, invalid = 0;
	object *objp;
	brief_stage *ptr = NULL;

	if (update)
		UpdateData(TRUE);

	// save off current data before we update over it with new briefing stage/team stuff
	Briefing = save_briefing;

	Mission_music[SCORE_BRIEFING] = m_briefing_music - 1;
	strcpy(The_mission.substitute_briefing_music_name, m_substitute_briefing_music);
	if (m_last_stage >= 0) {
		ptr = &Briefing->stages[m_last_stage];
		deconvert_multiline_string(buf3, m_text, MAX_BRIEF_LEN);
		if (stricmp(ptr->new_text, buf3))
			set_modified();

		strcpy(ptr->new_text, buf3);
		MODIFY(ptr->camera_time, atoi(m_time));
		string_copy(ptr->voice, m_voice, MAX_FILENAME_LEN, 1);
		i = ptr->flags;
		if (m_cut_prev)
			i |= BS_BACKWARD_CUT;
		else
			i &= ~BS_BACKWARD_CUT;

		if (m_cut_next)
			i |= BS_FORWARD_CUT;
		else
			i &= ~BS_FORWARD_CUT;

		MODIFY(ptr->flags, i);
		ptr->formula = m_tree.save_tree();
		switch (m_lines.GetCheck()) {
			case 1:
				// add lines between every pair of 2 marked icons if there isn't one already.
				for (i=0; i<ptr->num_icons - 1; i++)
					for (j=i+1; j<ptr->num_icons; j++) {
						if ( icon_marked[i] && icon_marked[j] ) {
							for (l=0; l<ptr->num_lines; l++)
								if ( ((ptr->lines[l].start_icon == i) && (ptr->lines[l].end_icon == j)) || ((ptr->lines[l].start_icon == j) && (ptr->lines[l].end_icon == i)) )
									break;

							if ((l == ptr->num_lines) && (l < MAX_BRIEF_STAGE_LINES)) {
								ptr->lines[l].start_icon = i;
								ptr->lines[l].end_icon = j;
								ptr->num_lines++;
							}
						}
					}

				break;

			case 0:
				// remove all existing lines between any 2 marked icons
				i = ptr->num_lines;
				while (i--)
					if ( icon_marked[ptr->lines[i].start_icon] && icon_marked[ptr->lines[i].end_icon] ) {
						ptr->num_lines--;
						for (l=i; l<ptr->num_lines; l++)
							ptr->lines[l] = ptr->lines[l + 1];
					}

				break;
		}

		if (m_last_icon >= 0) {
			valid = (m_id != ptr->icons[m_last_icon].id);
			if (m_id >= 0) {
				if (valid && !m_change_local) {
					for (i=m_last_stage+1; i<Briefing->num_stages; i++) {
						if (find_icon(m_id, i) >= 0) {
							char msg[1024];

							valid = 0;
							sprintf(msg, "Icon ID #%d is already used in a later stage.  You can only\n"
								"change to that ID locally.  Icon ID has been reset back to %d", m_id, ptr->icons[m_last_icon].id);

							m_id = ptr->icons[m_last_icon].id;
							MessageBox(msg);
							break;
						}
					}
				}

				for (i=0; i<ptr->num_icons; i++)
					if ((i != m_last_icon) && (ptr->icons[i].id == m_id)) {
						char msg[1024];

						sprintf(msg, "Icon ID #%d is already used in this stage.  Icon ID has been reset back to %d",
							m_id, ptr->icons[m_last_icon].id);

						m_id = ptr->icons[m_last_icon].id;
						MessageBox(msg);
						break;
					}

				if (valid && !m_change_local) {
					set_modified();
					reset_icon_loop(m_last_stage);
					while (get_next_icon(ptr->icons[m_last_icon].id))
						iconp->id = m_id;
				}
			}

			ptr->icons[m_last_icon].id = m_id;
			string_copy(buf, m_icon_label, MAX_LABEL_LEN);
			if (stricmp(ptr->icons[m_last_icon].label, buf) && !m_change_local) {
				set_modified();
				reset_icon_loop(m_last_stage);
				while (get_next_icon(m_id))
					strcpy(iconp->label, buf);
			}

			strcpy(ptr->icons[m_last_icon].label, buf);
			if ( m_hilight )
				ptr->icons[m_last_icon].flags |= BI_HIGHLIGHT;
			else
				ptr->icons[m_last_icon].flags &= ~BI_HIGHLIGHT;

			if (m_flipicon)
				ptr->icons[m_last_icon].flags |= BI_MIRROR_ICON;
			else
				ptr->icons[m_last_icon].flags &= ~BI_MIRROR_ICON;

			if ((ptr->icons[m_last_icon].type != m_icon_image) && !m_change_local) {
				set_modified();
				reset_icon_loop(m_last_stage);
				while (get_next_icon(m_id))
					iconp->type = m_icon_image;
			}

			ptr->icons[m_last_icon].type = m_icon_image;
			if ((ptr->icons[m_last_icon].team != m_icon_team) && !m_change_local) {
				set_modified();
				reset_icon_loop(m_last_stage);
				while (get_next_icon(m_id))
					iconp->team = m_icon_team;
			}

			ptr->icons[m_last_icon].team = m_icon_team;
			if ((ptr->icons[m_last_icon].ship_class != m_ship_type) && !m_change_local) {
				set_modified();
				reset_icon_loop(m_last_stage);
				while (get_next_icon(m_id))
					iconp->ship_class = m_ship_type;
			}

			MODIFY(ptr->icons[m_last_icon].ship_class, m_ship_type);
			deconvert_multiline_string(buf2, m_icon_text, MAX_ICON_TEXT_LEN);
/*
			if (stricmp(ptr->icons[m_last_icon].text, buf2) && !m_change_local) {
				set_modified();
				reset_icon_loop(m_last_stage);
				while (get_next_icon(m_id))
					strcpy(iconp->text, buf2);
			}

			strcpy(ptr->icons[m_last_icon].text, buf2);
*/
		}
	}

	if (!::IsWindow(m_hWnd))
		return;

	// set briefing pointer to correct team
	Briefing = &Briefings[m_current_briefing];

	if ((m_cur_stage >= 0) && (m_cur_stage < Briefing->num_stages)) {
		ptr = &Briefing->stages[m_cur_stage];
		m_stage_title.Format("Stage %d of %d", m_cur_stage + 1, Briefing->num_stages);
		m_text = convert_multiline_string(ptr->new_text);
		m_time.Format("%d", ptr->camera_time);
		m_voice = ptr->voice;
		m_cut_prev = (ptr->flags & BS_BACKWARD_CUT) ? 1 : 0;
		m_cut_next = (ptr->flags & BS_FORWARD_CUT) ? 1 : 0;
		m_tree.load_tree(ptr->formula);

	} else {
		m_stage_title = _T("No stages");
		m_text = _T("");
		m_time = _T("");
		m_voice = _T("");
		m_cut_prev = m_cut_next = 0;
		m_tree.clear_tree();
		enable = FALSE;
		m_cur_stage = -1;
	}

	if (m_cur_stage == Briefing->num_stages - 1)
		GetDlgItem(IDC_NEXT) -> EnableWindow(FALSE);
	else
		GetDlgItem(IDC_NEXT) -> EnableWindow(enable);

	if (m_cur_stage)
		GetDlgItem(IDC_PREV) -> EnableWindow(enable);
	else
		GetDlgItem(IDC_PREV) -> EnableWindow(FALSE);

	if (Briefing->num_stages >= MAX_BRIEF_STAGES)
		GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(FALSE);
	else
		GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(TRUE);

	if (Briefing->num_stages) {
		GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(enable);
		GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(enable);
	} else {
		GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(FALSE);
		GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(FALSE);
	}

	GetDlgItem(IDC_TIME) -> EnableWindow(enable);
	GetDlgItem(IDC_VOICE) -> EnableWindow(enable);
	GetDlgItem(IDC_BROWSE) -> EnableWindow(enable);
	GetDlgItem(IDC_TEXT) -> EnableWindow(enable);
	GetDlgItem(IDC_SAVE_VIEW) -> EnableWindow(enable);
	GetDlgItem(IDC_GOTO_VIEW) -> EnableWindow(enable);
	GetDlgItem(IDC_CUT_PREV) -> EnableWindow(enable);
	GetDlgItem(IDC_CUT_NEXT) -> EnableWindow(enable);
	GetDlgItem(IDC_TREE) -> EnableWindow(enable);
	GetDlgItem(IDC_PLAY) -> EnableWindow(enable);

	if ((m_cur_stage >= 0) && (m_cur_icon >= 0) && (m_cur_icon < ptr->num_icons)) {
		m_hilight = (ptr->icons[m_cur_icon].flags & BI_HIGHLIGHT)?1:0;
		m_flipicon = (ptr->icons[m_cur_icon].flags & BI_MIRROR_ICON)?1:0;
		m_icon_image = ptr->icons[m_cur_icon].type;
		m_icon_team = ptr->icons[m_cur_icon].team;
		m_icon_label = ptr->icons[m_cur_icon].label;
		m_ship_type = ptr->icons[m_cur_icon].ship_class;
//		m_icon_text = convert_multiline_string(ptr->icons[m_cur_icon].text);
		m_id = ptr->icons[m_cur_icon].id;
		enable = TRUE;

	} else {
		m_flipicon = FALSE;
		m_hilight = FALSE;
		m_icon_image = -1;
		m_icon_team = -1;
		m_ship_type = -1;
		m_icon_label = _T("");
		m_cur_icon = -1;
		m_id = 0;
		enable = FALSE;
	}

	GetDlgItem(IDC_ICON_TEXT) -> EnableWindow(enable);
	GetDlgItem(IDC_ICON_LABEL) -> EnableWindow(enable);
	GetDlgItem(IDC_ICON_IMAGE) -> EnableWindow(enable);
	GetDlgItem(IDC_SHIP_TYPE) -> EnableWindow(enable);
	GetDlgItem(IDC_HILIGHT) -> EnableWindow(enable);
	GetDlgItem(IDC_FLIP_ICON) -> EnableWindow(enable);
	GetDlgItem(IDC_LOCAL) -> EnableWindow(enable);
	GetDlgItem(IDC_TEAM) -> EnableWindow(enable);
	GetDlgItem(IDC_ID) -> EnableWindow(enable);
	GetDlgItem(IDC_DELETE_ICON) -> EnableWindow(enable);

	valid = invalid = 0;
	objp = GET_FIRST(&obj_used_list);
	while (objp != END_OF_LIST(&obj_used_list)) {
		if (objp->flags & OF_MARKED) {
			if ((objp->type == OBJ_SHIP) || (objp->type == OBJ_START) || (objp->type == OBJ_WAYPOINT) || (objp->type == OBJ_JUMP_NODE))
				valid = 1;
			else
				invalid = 1;
		}

		objp = GET_NEXT(objp);
	}

	if (m_cur_stage >= 0)
		ptr = &Briefing->stages[m_cur_stage];

	if (valid && !invalid && (m_cur_stage >= 0) && (ptr->num_icons < MAX_STAGE_ICONS))
		GetDlgItem(IDC_MAKE_ICON) -> EnableWindow(TRUE);
	else
		GetDlgItem(IDC_MAKE_ICON) -> EnableWindow(FALSE);

	if (m_cur_stage >= 0)
		for (i=0; i<ptr->num_icons; i++)
			icon_marked[i] = 0;

	valid = invalid = 0;
	objp = GET_FIRST(&obj_used_list);
	while (objp != END_OF_LIST(&obj_used_list)) {
		if (objp->flags & OF_MARKED) {
			if (objp->type == OBJ_POINT) {
				valid++;
				icon_marked[objp->instance] = 1;

			} else
				invalid++;
		}

		objp = GET_NEXT(objp);
	}

	if (valid && !invalid && (m_cur_stage >= 0))
		GetDlgItem(IDC_PROPAGATE_ICONS) -> EnableWindow(TRUE);
	else
		GetDlgItem(IDC_PROPAGATE_ICONS) -> EnableWindow(FALSE);

	count = 0;
	lines = 1;  // default lines checkbox to checked
	
	if (m_cur_stage >= 0) {
		for (i=0; i<ptr->num_lines; i++)
			line_marked[i] = 0;

		// go through and locate all lines between marked icons
		for (i=0; i<ptr->num_icons - 1; i++)
			for (j=i+1; j<ptr->num_icons; j++) {
				if ( icon_marked[i] && icon_marked[j] ) {
					for (l=0; l<ptr->num_lines; l++)
						if ( ((ptr->lines[l].start_icon == i) && (ptr->lines[l].end_icon == j)) || ((ptr->lines[l].start_icon == j) && (ptr->lines[l].end_icon == i)) ) {
							line_marked[l] = 1;
							count++;  // track number of marked lines (lines between 2 icons that are both marked)
							break;
						}

					// at least 1 line missing between 2 marked icons, so use mixed state
					if (l == ptr->num_lines)
						lines = 2;
				}
			}
	}

	// not even 1 line between any 2 marked icons?  Set checkbox to unchecked.
	if (!count)
		lines = 0;

	i = 0;
	if (m_cur_stage >= 0){
		i = calc_num_lines_for_icons(valid) + ptr->num_lines - count;
	}

	if ((valid > 1) && !invalid && (m_cur_stage >= 0) && (i <= MAX_BRIEF_STAGE_LINES))
		GetDlgItem(IDC_LINES) -> EnableWindow(TRUE);
	else
		GetDlgItem(IDC_LINES) -> EnableWindow(FALSE);

	m_lines.SetCheck(lines);

	UpdateData(FALSE);
	if ((m_last_stage != m_cur_stage) || (Briefing != save_briefing)) {
		if (m_last_stage >= 0) {
			for (i=0; i<save_briefing->stages[m_last_stage].num_icons; i++) {
				// save positions of all icons, in case they have moved
				save_briefing->stages[m_last_stage].icons[i].pos = Objects[icon_obj[i]].pos;
				// release objects being used by last stage
				obj_delete(icon_obj[i]);
			}
		}

		if (m_cur_stage >= 0) {
			for (i=0; i<ptr->num_icons; i++) {
				// create an object for each icon for display/manipulation purposes
				icon_obj[i] = obj_create(OBJ_POINT, -1, i, NULL, &ptr->icons[i].pos, 0.0f, OF_RENDERS);
			}

			obj_merge_created_list();
		}

		m_last_stage = m_cur_stage;
	}

	m_last_icon = m_cur_icon;
	Update_window = 1;
	save_briefing = Briefing;
}
示例#6
0
void cmd_brief_dlg::update_data(int update)
{
	int enable;

	if (update)
		UpdateData(TRUE);

	// save previously editing data before we load over it.
	if (last_cmd_brief && m_last_stage >= 0 && m_last_stage < last_cmd_brief->num_stages) {
		char buf[CMD_BRIEF_TEXT_MAX];

		if (last_cmd_brief->stage[m_last_stage].text)
			free(last_cmd_brief->stage[m_last_stage].text);

		deconvert_multiline_string(buf, m_text, CMD_BRIEF_TEXT_MAX);
		last_cmd_brief->stage[m_last_stage].text = strdup(buf);
		string_copy(last_cmd_brief->stage[m_last_stage].ani_filename, m_ani_filename, MAX_FILENAME_LEN);
		string_copy(last_cmd_brief->stage[m_last_stage].wave_filename, m_wave_filename, MAX_FILENAME_LEN);
	}

	// load data of new stage into dialog
	if (Cur_cmd_brief && Cur_cmd_brief->num_stages > 0) {
		if (m_cur_stage < 0 || m_cur_stage >= Cur_cmd_brief->num_stages)
			m_cur_stage = 0;

		m_stage_title.Format("Stage %d of %d", m_cur_stage + 1, Cur_cmd_brief->num_stages);
		m_text = convert_multiline_string(Cur_cmd_brief->stage[m_cur_stage].text);
		m_ani_filename = Cur_cmd_brief->stage[m_cur_stage].ani_filename;
		m_wave_filename = Cur_cmd_brief->stage[m_cur_stage].wave_filename;
		enable = TRUE;

	} else {
		m_stage_title = _T("No stages");
		m_text = _T("");
		m_ani_filename = _T("");
		m_wave_filename = _T("");
		enable = FALSE;
		m_cur_stage = -1;
	}

	if (m_cur_stage < Cur_cmd_brief->num_stages - 1)
		GetDlgItem(IDC_NEXT) -> EnableWindow(enable);
	else
		GetDlgItem(IDC_NEXT) -> EnableWindow(FALSE);

	if (m_cur_stage)
		GetDlgItem(IDC_PREV) -> EnableWindow(enable);
	else
		GetDlgItem(IDC_PREV) -> EnableWindow(FALSE);

	if (Cur_cmd_brief->num_stages >= CMD_BRIEF_STAGES_MAX)
		GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(FALSE);
	else
		GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(TRUE);

	if (Cur_cmd_brief->num_stages) {
		GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(enable);
		GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(enable);

	} else {
		GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(FALSE);
		GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(FALSE);
	}

	GetDlgItem(IDC_WAVE_FILENAME) -> EnableWindow(enable);
	GetDlgItem(IDC_ANI_FILENAME) -> EnableWindow(enable);
	GetDlgItem(IDC_BROWSE_ANI) -> EnableWindow(enable);
	GetDlgItem(IDC_BROWSE_WAVE) -> EnableWindow(enable);
	GetDlgItem(IDC_TEXT) -> EnableWindow(enable);

	UpdateData(FALSE);

	last_cmd_brief = Cur_cmd_brief;
	m_last_stage = m_cur_stage;
}
BOOL CMissionNotesDlg::OnInitDialog() 
{
	int i;
	CComboBox *box;
	

	// set up the radio box states
	coop = (CButton *)GetDlgItem(IDC_COOP);
	team = (CButton *)GetDlgItem(IDC_TEAMVTEAM);
	dogfight = (CButton *)GetDlgItem(IDC_DOGFIGHT);

	m_mission_title_orig = m_mission_title = _T(The_mission.name);
	m_designer_name_orig = m_designer_name = _T(The_mission.author);
	m_created = _T(The_mission.created);
	m_modified = _T(The_mission.modified);
	m_mission_notes_orig = m_mission_notes = convert_multiline_string(The_mission.notes);
	m_mission_desc_orig = m_mission_desc = convert_multiline_string(The_mission.mission_desc);
	m_red_alert = The_mission.red_alert;
	m_scramble = The_mission.scramble;
	m_disallow_support = (The_mission.support_ships.max_support_ships == 0) ? 1 : 0;
	m_no_promotion = (The_mission.flags & MISSION_FLAG_NO_PROMOTION) ? 1 : 0;
	m_no_builtin_msgs = (The_mission.flags & MISSION_FLAG_NO_BUILTIN_MSGS) ? 1 : 0;
	m_no_traitor = (The_mission.flags & MISSION_FLAG_NO_TRAITOR) ? 1 : 0;
	m_ship_trails = (The_mission.flags & MISSION_FLAG_SHIP_TRAILS) ? 1 : 0;
	m_support_repairs_hull = (The_mission.flags &MISSION_FLAG_SUPPORT_REPAIRS_HULL) ? 1 : 0;
	m_beam_free_all_by_default = (The_mission.flags & MISSION_FLAG_BEAM_FREE_ALL_BY_DEFAULT) ? 1 : 0;
//	m_old_warp_effect = (The_mission.flags & MISSION_FLAG_OLD_WARP_EFFECT) ? 1 : 0;
	m_no_briefing = (The_mission.flags & MISSION_FLAG_NO_BRIEFING) ? 1 : 0;
	m_no_debriefing = (The_mission.flags & MISSION_FLAG_NO_DEBRIEFING) ? 1 : 0;

	m_loading_640=_T(The_mission.loading_screen[GR_640]);
	m_loading_1024=_T(The_mission.loading_screen[GR_1024]);

	//CDialog::OnInitDialog();
//return TRUE;
	box = (CComboBox *) GetDlgItem(IDC_MUSIC);
	box->AddString("None");
	for (i=0; i<Num_soundtracks; i++){
		box->AddString(Soundtracks[i].name);		
	}

	// squad info
	if(strlen(The_mission.squad_name) > 0){
		m_squad_name = _T(The_mission.squad_name);
		m_squad_filename = _T(The_mission.squad_filename);
	} else {
		m_squad_name = _T(NO_SQUAD);
		m_squad_filename = _T("");
	}

	m_type = The_mission.game_type;
	m_music = Current_soundtrack_num + 1;
	m_full_war = Mission_all_attack;

	// set up the game type checkboxes accoring to m_type
	if ( m_type & MISSION_TYPE_SINGLE ){
		((CButton *) GetDlgItem(IDC_SINGLE))->SetCheck(1);
	}

	// for multiplayer -- be sure to assign a default type if not already assigned.
	if ( m_type & MISSION_TYPE_MULTI ){
		((CButton *) GetDlgItem(IDC_MULTI))->SetCheck(1);
	}

	if ( m_type & MISSION_TYPE_TRAINING ){
		((CButton *) GetDlgItem(IDC_TRAINING))->SetCheck(1);
	}

	// we need to set one of these three multiplayer modes so interface looks correct
	if ( !(m_type & (MISSION_TYPE_MULTI_COOP | MISSION_TYPE_MULTI_DOGFIGHT | MISSION_TYPE_MULTI_TEAMS)) ){
		m_type |= MISSION_TYPE_MULTI_COOP;
	}

	if ( m_type & MISSION_TYPE_MULTI_COOP ){
		coop->SetCheck(1);
	} else if ( m_type & MISSION_TYPE_MULTI_TEAMS ){
		team->SetCheck(1);
	} else if ( m_type & MISSION_TYPE_MULTI_DOGFIGHT ){
		dogfight->SetCheck(1);
	} else {
		Int3();			// get allender -- multiplayer mode not set!!!
	}

	m_respawn_spin.SetRange(0, 99);
	m_num_respawns = The_mission.num_respawns;
	m_max_hull_repair_val = The_mission.support_ships.max_hull_repair_val;
	m_max_subsys_repair_val = The_mission.support_ships.max_subsys_repair_val;

	set_types();
	UpdateData(FALSE);
	theApp.init_window(&Mission_notes_wnd_data, this);
	return TRUE;
}