Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fred2/bgbitmapdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ void bg_bitmap_dlg::OnClose()
// close window stuff
theApp.record_window_data(&Bg_wnd_data, this);
delete Bg_bitmap_dialog;
Bg_bitmap_dialog = NULL;
Bg_bitmap_dialog = nullptr;

FREDDoc_ptr->autosave("background editor");
}
Expand Down
26 changes: 15 additions & 11 deletions fred2/briefingeditordlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,23 @@ void briefing_editor_dlg::create()

void briefing_editor_dlg::focus_sexp(int select_sexp_node)
{
int i, n;
int i, t, n;

n = m_tree.select_sexp_node = select_sexp_node;
if (n != -1) {
for (i=0; i<Briefing->num_stages; i++)
if (query_node_in_sexp(n, Briefing->stages[i].formula))
break;
if (n == -1)
return;

if (i < Briefing->num_stages) {
m_cur_stage = i;
update_data();
GetDlgItem(IDC_TREE) -> SetFocus();
m_tree.hilite_item(m_tree.select_sexp_node);
for (t = 0; t < Num_teams; t++) {
for (i = 0; i < Briefings[t].num_stages; i++) {
if (query_node_in_sexp(n, Briefings[t].stages[i].formula)) {
m_current_briefing = t;
Briefing = &Briefings[t];
m_cur_stage = i;
update_data();
GetDlgItem(IDC_TREE)->SetFocus();
m_tree.hilite_item(m_tree.select_sexp_node);
return;
}
}
}
}
Expand Down Expand Up @@ -307,7 +311,7 @@ void briefing_editor_dlg::OnClose()

theApp.record_window_data(&Briefing_wnd_data, this);
ptr = Briefing_dialog; // this juggling prevents a crash in certain situations
Briefing_dialog = NULL;
Briefing_dialog = nullptr;
delete ptr;

FREDDoc_ptr->autosave("briefing editor");
Expand Down
79 changes: 53 additions & 26 deletions fred2/debriefingeditordlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,35 @@ debriefing_editor_dlg::debriefing_editor_dlg(CWnd* pParent /*=NULL*/)
select_sexp_node = -1;
}

void debriefing_editor_dlg::create()
{
CDialog::Create(IDD);
theApp.init_window(&Debriefing_wnd_data, this);
}

void debriefing_editor_dlg::focus_sexp(int node)
{
int i, t, n;

n = m_tree.select_sexp_node = node;
if (n == -1)
return;

for (t = 0; t < Num_teams; t++) {
for (i = 0; i < Debriefings[t].num_stages; i++) {
if (query_node_in_sexp(n, Debriefings[t].stages[i].formula)) {
m_current_debriefing = t;
Debriefing = &Debriefings[t];
m_cur_stage = i;
update_data();
GetDlgItem(IDC_TREE)->SetFocus();
m_tree.hilite_item(m_tree.select_sexp_node);
return;
}
}
}
}

void debriefing_editor_dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
Expand Down Expand Up @@ -118,8 +147,6 @@ void debriefing_editor_dlg::OnInitMenu(CMenu* pMenu)

BOOL debriefing_editor_dlg::OnInitDialog()
{
int i, n;

CDialog::OnInitDialog();
m_play_bm.LoadBitmap(IDB_PLAY);
((CButton *) GetDlgItem(IDC_PLAY)) -> SetBitmap(m_play_bm);
Expand Down Expand Up @@ -151,28 +178,15 @@ BOOL debriefing_editor_dlg::OnInitDialog()
m_debriefFail_music = Mission_music[SCORE_DEBRIEFING_FAILURE] + 1;

m_tree.link_modified(&modified); // provide way to indicate trees are modified in dialog
n = m_tree.select_sexp_node = select_sexp_node;
select_sexp_node = -1;
if (n != -1) {
for (i=0; i<Debriefing->num_stages; i++)
if (query_node_in_sexp(n, Debriefing->stages[i].formula))
break;

if (i < Debriefing->num_stages) {
m_cur_stage = i;
update_data();
GetDlgItem(IDC_TREE) -> SetFocus();
m_tree.hilite_item(m_tree.select_sexp_node);
set_modified();
return FALSE;
}
}

CDialog::OnInitDialog();
update_data();
set_modified();

// hard coded stuff to deal with the multiple briefings per mission.
if (select_sexp_node != -1) {
focus_sexp(select_sexp_node);
select_sexp_node = -1;
return FALSE;
}

return TRUE;
}
Expand Down Expand Up @@ -201,10 +215,20 @@ void debriefing_editor_dlg::update_data(int update)
free_sexp2(ptr->formula);

ptr->formula = m_tree.save_tree();
deconvert_multiline_string(ptr->text, m_text);
lcl_fred_replace_stuff(ptr->text);
deconvert_multiline_string(ptr->recommendation_text, m_rec_text);
lcl_fred_replace_stuff(ptr->recommendation_text);

SCP_string new_text, new_rec_text;
deconvert_multiline_string(new_text, m_text);
lcl_fred_replace_stuff(new_text);
deconvert_multiline_string(new_rec_text, m_rec_text);
lcl_fred_replace_stuff(new_rec_text);

if (modified || ptr->text != new_text || ptr->recommendation_text != new_rec_text
|| stricmp(ptr->voice, m_voice) != 0)
set_modified();

modified = 0;
ptr->text = new_text;
ptr->recommendation_text = new_rec_text;
string_copy(ptr->voice, m_voice, MAX_FILENAME_LEN - 1);
}

Expand Down Expand Up @@ -425,7 +449,7 @@ void debriefing_editor_dlg::OnEndlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult)
*pResult = m_tree.end_label_edit(pTVDispInfo->item);
}

void debriefing_editor_dlg::OnClose()
void debriefing_editor_dlg::OnClose()
{
audiostream_close_file(m_voice_id, 0);
m_voice_id = -1;
Expand All @@ -436,7 +460,10 @@ void debriefing_editor_dlg::OnClose()
Mission_music[SCORE_DEBRIEFING_AVERAGE] = m_debriefAvg_music - 1;
Mission_music[SCORE_DEBRIEFING_FAILURE] = m_debriefFail_music - 1;

CDialog::OnClose();
theApp.record_window_data(&Debriefing_wnd_data, this);
debriefing_editor_dlg *ptr = Debriefing_dialog;
Debriefing_dialog = nullptr;
delete ptr;

FREDDoc_ptr->autosave("debriefing editor");
}
Expand Down
7 changes: 5 additions & 2 deletions fred2/debriefingeditordlg.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/

#pragma once

#include "mission/missionbriefcommon.h"

Expand All @@ -18,6 +19,8 @@ class debriefing_editor_dlg : public CDialog
// Construction
public:
void OnOK();
void create();
void focus_sexp(int node);
void update_data(int update = 1);
debriefing_editor_dlg(CWnd* pParent = NULL); // standard constructor
int select_sexp_node;
Expand Down
6 changes: 4 additions & 2 deletions fred2/fred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ wing_editor Wing_editor_dialog;
waypoint_path_dlg Waypoint_editor_dialog;
jumpnode_dlg Jumpnode_editor_dialog;
music_player_dlg Music_player_dialog;
bg_bitmap_dlg* Bg_bitmap_dialog = NULL;
briefing_editor_dlg* Briefing_dialog = NULL;
bg_bitmap_dlg* Bg_bitmap_dialog = nullptr;
briefing_editor_dlg* Briefing_dialog = nullptr;
debriefing_editor_dlg* Debriefing_dialog = nullptr;

window_data Main_wnd_data;
window_data Ship_wnd_data;
Expand All @@ -136,6 +137,7 @@ window_data Player_wnd_data;
window_data Events_wnd_data;
window_data Bg_wnd_data;
window_data Briefing_wnd_data;
window_data Debriefing_wnd_data;
window_data Reinforcement_wnd_data;
window_data Waypoint_wnd_data;
window_data Jumpnode_wnd_data;
Expand Down
5 changes: 4 additions & 1 deletion fred2/fred.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "BgBitmapDlg.h"
#include "BriefingEditorDlg.h"
#include "DebriefingEditorDlg.h"
#include "resource.h"
#include "ShipEditorDlg.h"
#include "propdlg.h"
Expand Down Expand Up @@ -187,7 +188,8 @@ extern waypoint_path_dlg Waypoint_editor_dialog; //!< The waypoint editor ins
extern jumpnode_dlg Jumpnode_editor_dialog; //!< The jumpnode editor instance
extern music_player_dlg Music_player_dialog; //!< The music player instance
extern bg_bitmap_dlg* Bg_bitmap_dialog; //!< The bitmap dialog instance
extern briefing_editor_dlg* Briefing_dialog; //!< The briefing editor instance
extern briefing_editor_dlg* Briefing_dialog; //!< The briefing editor instance
extern debriefing_editor_dlg* Debriefing_dialog; //!< The debriefing editor instance

extern CFREDApp theApp; //!< The application instance

Expand All @@ -203,6 +205,7 @@ extern window_data Player_wnd_data;
extern window_data Events_wnd_data;
extern window_data Bg_wnd_data;
extern window_data Briefing_wnd_data;
extern window_data Debriefing_wnd_data;
extern window_data Reinforcement_wnd_data;
extern window_data Waypoint_wnd_data;
extern window_data Jumpnode_wnd_data;
Expand Down
9 changes: 7 additions & 2 deletions fred2/fredview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4213,9 +4213,14 @@ void CFREDView::OnEditorsBriefing()

void CFREDView::OnEditorsDebriefing()
{
debriefing_editor_dlg dlg;
if (!Debriefing_dialog) {
Debriefing_dialog = new debriefing_editor_dlg;
Debriefing_dialog->create();
}

dlg.DoModal();
Debriefing_dialog->SetWindowPos(&wndTop, 0, 0, 0, 0,
SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
Debriefing_dialog->ShowWindow(SW_RESTORE);
}

void CFREDView::OnSaveCamera()
Expand Down
11 changes: 8 additions & 3 deletions fred2/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2283,10 +2283,15 @@ int sexp_reference_handler(int node, sexp_src source, int source_index, char *ms
}

case sexp_src::DEBRIEFING: {
debriefing_editor_dlg dlg;
if (!Debriefing_dialog) {
Debriefing_dialog = new debriefing_editor_dlg;
Debriefing_dialog->create();
}

dlg.select_sexp_node = node;
dlg.DoModal();
Debriefing_dialog->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0,
SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
Debriefing_dialog->ShowWindow(SW_RESTORE);
Debriefing_dialog->focus_sexp(node);
break;
}

Expand Down
Loading