Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Axem on October 03, 2011, 06:17:49 pm
-
Hey there FRED coder(s). I have a hopefully small request. The ability for the FREDder to select different debriefing musics. We can select Fiction viewer and briefing music, why not debriefing?
My idea would be three drop down boxes in the Debriefing Editor, where the FREDder can select the Success, Average and Fail entries from a music tbl/tbm. The three would obviously default to the originals.
The person who implements this gets 50 Axembux*!
*Due to hyperinflation, Axembux may be worthless in weeks days hours minutes!
-
I'm being told that this feature may already be in the game (in missionparse) just not added to the FRED gui...
Let this be a reminder then!
-
wat rly :/
-
So having a quick look in the code (thanks Eli for pointing me in the right direction), I have come to the conclusion that, yes indeed this feature is already in the codebase!
For any adventurous FREDder who wants to use it, here's how! (Until someone adds the GUI elements in. In notepad look for #Music and add the last three (and optional) lines.
#Music
$Event Music: None
$Briefing Music: None
$Debriefing Success Music: Brief6
$Debriefing Average Music: Cinema
$Debriefing Failure Music: Brief1
As you can see, I have brief6 playing for winning, and cinema for average!
-
You are le awesome Axem
-
But I didn't do anyt- :nervous:
Yes, yes I am.
-
Remind me about this on Friday and I'll add it to FRED. I've promised not to let coding distract me from FREDding until then but if I need a break from FRED I may code it before then.
-
Zacam seems to be working on adding these to FRED already.
Though if you want something to add to FRED... (http://www.hard-light.net/wiki/index.php/Cutscene_flags)
-
This was supposed to be a secret feature! :hopping:
(Not really; I was too lazy to add it to the gui. But I'll take those Axembux.)
-
Zacam seems to be working on adding these to FRED already.
Though if you want something to add to FRED... (http://www.hard-light.net/wiki/index.php/Cutscene_flags)
There's a good reason why I've never gotten around to adding that stuff. Although adding most of that stuff is fairly easy, adding a generic way of choosing the SEXP formula that can be reused by other editors is a fairly big task. It's on the list for soon after I have no work for Diaspora R1.
-
I seem to have the basic structure for it worked out. I just need to add the graphical elements/positions to the .rc file to actually test it out with and then I'll have a .patch to post (assuming that it works)
Edit: Okay, so I have what I think is a rudimentary adjustment to make it all happen. I'll put the code/patch up first for critical review, then based on feedback I'll link some test builds based on that.
Index: debriefingeditordlg.cpp
===================================================================
--- debriefingeditordlg.cpp (revision 7857)
+++ debriefingeditordlg.cpp (working copy)
@@ -14,7 +14,10 @@
#include "DebriefingEditorDlg.h"
#include "FREDDoc.h"
#include "mission/missionbriefcommon.h"
+#include "mission/missionparse.h"
+#include "globalincs/linklist.h"
#include "parse/sexp.h"
+#include "gamesnd/eventmusic.h"
#include "cfile/cfile.h"
#include "sound/audiostr.h"
#include "localization/localize.h"
@@ -35,6 +38,9 @@
m_voice = _T("");
m_stage_title = _T("");
m_rec_text = _T("");
+ m_debriefPass_music = -1;
+ m_debriefAvg_music = -1;
+ m_debriefFail_music = -1;
m_current_debriefing = -1;
//}}AFX_DATA_INIT
@@ -54,6 +60,9 @@
DDX_Text(pDX, IDC_VOICE, m_voice);
DDX_Text(pDX, IDC_STAGE_TITLE, m_stage_title);
DDX_Text(pDX, IDC_REC_TEXT, m_rec_text);
+ DDX_CBIndex(pDX, IDC_SUCCESSFUL_MISSION_TRACK, m_debriefPass_music);
+ DDX_CBIndex(pDX, IDC_DEBRIEFING_TRACK, m_debriefAvg_music);
+ DDX_CBIndex(pDX, IDC_FAILED_MISSION_TRACK, m_debriefFail_music);
//}}AFX_DATA_MAP
DDV_MaxChars(pDX, m_text, MAX_BRIEF_LEN - 1);
@@ -115,12 +124,32 @@
CDialog::OnInitDialog();
m_play_bm.LoadBitmap(IDB_PLAY);
((CButton *) GetDlgItem(IDC_PLAY)) -> SetBitmap(m_play_bm);
+ CComboBox *box;
+ box = (CComboBox *) GetDlgItem(IDC_ICON_IMAGE);
m_current_debriefing = 0;
UpdateData(FALSE);
+ m_debriefPass_music = Mission_music[SCORE_DEBRIEF_SUCCESS] + 1;
+ m_debriefAvg_music = Mission_music[SCORE_DEBRIEF_AVERAGE] + 1;
+ m_debriefFail_music = Mission_music[SCORE_DEBRIEF_FAIL] + 1;
Debriefing = &Debriefings[m_current_debriefing];
+ box = (CComboBox *) GetDlgItem(IDC_SUCCESSFUL_MISSION_TRACK);
+ box->AddString("None");
+ for (i=0; i<Num_music_files; i++)
+ box->AddString(Spooled_music[i].name);
+
+ box = (CComboBox *) GetDlgItem(IDC_DEBRIEFING_TRACK);
+ box->AddString("None");
+ for (i=0; i<Num_music_files; i++)
+ box->AddString(Spooled_music[i].name);
+
+ box = (CComboBox *) GetDlgItem(IDC_FAILED_MISSION_TRACK);
+ box->AddString("None");
+ for (i=0; i<Num_music_files; i++)
+ box->AddString(Spooled_music[i].name);
+
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;
@@ -152,6 +181,9 @@
int enable, save_debriefing;
debrief_stage *ptr;
+ Mission_music[SCORE_DEBRIEF_SUCCESS] = m_debriefPass_music - 1;
+ Mission_music[SCORE_DEBRIEF_AVERAGE] = m_debriefAvg_music - 1;
+ Mission_music[SCORE_DEBRIEF_FAIL] = m_debriefFail_music - 1;
save_debriefing = m_current_debriefing;
if (update)
Index: debriefingeditordlg.h
===================================================================
--- debriefingeditordlg.h (revision 7857)
+++ debriefingeditordlg.h (working copy)
@@ -8,6 +8,7 @@
*/
+#include "mission/missionbriefcommon.h"
/////////////////////////////////////////////////////////////////////////////
// debriefing_editor_dlg dialog
@@ -29,6 +30,9 @@
CString m_voice;
CString m_stage_title;
CString m_rec_text;
+ int m_debriefPass_music;
+ int m_debriefAvg_music;
+ int m_debriefFail_music;
int m_current_debriefing;
//}}AFX_DATA
Index: fred.rc
===================================================================
--- fred.rc (revision 7857)
+++ fred.rc (working copy)
@@ -1646,7 +1646,7 @@
CONTROL "order 10",IDC_CHECK10,"Button",BS_3STATE | WS_TABSTOP,7,183,105,10
END
-IDD_DEBRIEFING_EDITOR DIALOGEX 0, 0, 322, 172
+IDD_DEBRIEFING_EDITOR DIALOGEX 0, 0, 322, 225
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Debriefing Editor"
MENU IDR_PLAYER_EDIT_MENU
@@ -1668,6 +1668,13 @@
LTEXT "Stage 1 of 9",IDC_STAGE_TITLE,7,10,53,8
LTEXT "Usage Formula",IDC_STATIC,7,43,48,8
LTEXT "Recommendation Text",IDC_STATIC,135,96,72,8
+ GROUPBOX "Debriefing Music",IDC_STATIC,7,175,260,45
+ LTEXT "Success Music",IDC_STATIC,15,187,53,8
+ COMBOBOX IDC_SUCCESSFUL_MISSION_TRACK,12,195,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Average Music",IDC_STATIC,100,187,53,8
+ COMBOBOX IDC_DEBRIEFING_TRACK,97,195,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "Failure Music",IDC_STATIC,185,187,53,8
+ COMBOBOX IDC_FAILED_MISSION_TRACK,182,195,80,180,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_ADJUST_GRID DIALOG 0, 0, 153, 94
[attachment deleted by ninja]
-
Ummmm. What is calling the update_data function? I don't see any OnSelectionChanged() style functions.
-
Here we go, updated patch.
Index: code/fred2/debriefingeditordlg.cpp
===================================================================
--- code/fred2/debriefingeditordlg.cpp (revision 7859)
+++ code/fred2/debriefingeditordlg.cpp (working copy)
@@ -14,7 +14,10 @@
#include "DebriefingEditorDlg.h"
#include "FREDDoc.h"
#include "mission/missionbriefcommon.h"
+#include "mission/missionparse.h"
+#include "globalincs/linklist.h"
#include "parse/sexp.h"
+#include "gamesnd/eventmusic.h"
#include "cfile/cfile.h"
#include "sound/audiostr.h"
#include "localization/localize.h"
@@ -35,6 +38,9 @@
m_voice = _T("");
m_stage_title = _T("");
m_rec_text = _T("");
+ m_debriefPass_music = 0;
+ m_debriefAvg_music = 0;
+ m_debriefFail_music = 0;
m_current_debriefing = -1;
//}}AFX_DATA_INIT
@@ -54,6 +60,9 @@
DDX_Text(pDX, IDC_VOICE, m_voice);
DDX_Text(pDX, IDC_STAGE_TITLE, m_stage_title);
DDX_Text(pDX, IDC_REC_TEXT, m_rec_text);
+ DDX_CBIndex(pDX, IDC_SUCCESSFUL_MISSION_TRACK, m_debriefPass_music);
+ DDX_CBIndex(pDX, IDC_DEBRIEFING_TRACK, m_debriefAvg_music);
+ DDX_CBIndex(pDX, IDC_FAILED_MISSION_TRACK, m_debriefFail_music);
//}}AFX_DATA_MAP
DDV_MaxChars(pDX, m_text, MAX_BRIEF_LEN - 1);
@@ -115,12 +124,33 @@
CDialog::OnInitDialog();
m_play_bm.LoadBitmap(IDB_PLAY);
((CButton *) GetDlgItem(IDC_PLAY)) -> SetBitmap(m_play_bm);
+ CComboBox *box;
+ box = (CComboBox *) GetDlgItem(IDC_ICON_IMAGE);
m_current_debriefing = 0;
UpdateData(FALSE);
Debriefing = &Debriefings[m_current_debriefing];
+ box = (CComboBox *) GetDlgItem(IDC_SUCCESSFUL_MISSION_TRACK);
+ box->AddString("None");
+ for (i=0; i<Num_music_files; i++)
+ box->AddString(Spooled_music[i].name);
+
+ box = (CComboBox *) GetDlgItem(IDC_DEBRIEFING_TRACK);
+ box->AddString("None");
+ for (i=0; i<Num_music_files; i++)
+ box->AddString(Spooled_music[i].name);
+
+ box = (CComboBox *) GetDlgItem(IDC_FAILED_MISSION_TRACK);
+ box->AddString("None");
+ for (i=0; i<Num_music_files; i++)
+ box->AddString(Spooled_music[i].name);
+
+ m_debriefPass_music = Mission_music[SCORE_DEBRIEF_SUCCESS] + 1;
+ m_debriefAvg_music = Mission_music[SCORE_DEBRIEF_AVERAGE] + 1;
+ m_debriefFail_music = Mission_music[SCORE_DEBRIEF_FAIL] + 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;
@@ -139,6 +169,7 @@
}
}
+ CDialog::OnInitDialog();
update_data();
set_modified();
@@ -402,6 +433,11 @@
m_voice_id = -1;
m_cur_stage = -1;
update_data(1);
+
+ Mission_music[SCORE_DEBRIEF_SUCCESS] = m_debriefPass_music - 1;
+ Mission_music[SCORE_DEBRIEF_AVERAGE] = m_debriefAvg_music - 1;
+ Mission_music[SCORE_DEBRIEF_FAIL] = m_debriefFail_music - 1;
+
CDialog::OnClose();
}
Index: code/fred2/debriefingeditordlg.h
===================================================================
--- code/fred2/debriefingeditordlg.h (revision 7859)
+++ code/fred2/debriefingeditordlg.h (working copy)
@@ -8,6 +8,7 @@
*/
+#include "mission/missionbriefcommon.h"
/////////////////////////////////////////////////////////////////////////////
// debriefing_editor_dlg dialog
@@ -29,6 +30,9 @@
CString m_voice;
CString m_stage_title;
CString m_rec_text;
+ int m_debriefPass_music;
+ int m_debriefAvg_music;
+ int m_debriefFail_music;
int m_current_debriefing;
//}}AFX_DATA
[attachment deleted by ninja]
-
Thank you for the testing and feedback, Karajorma. I hit a roadblock on making sure that modifications would update (which you almost gave up on too, so I'm glad it wasn't just me).
Linked test builds, SSE2 Release and Debug for folks to test this change out with and find any errors before it goes to Trunk.
Also updated and attached the "complete" patch, since kara's lost the rc file information.
Fred2_DebriefMusic_SSE2.7z (http://www.mediafire.com/file/b43l54fadkp4xlv/Fred2_DebriefMusic_SSE2.7z)
MD5: E6015CE6EC6CC4889DEB553D77F7F7D1
[attachment deleted by ninja]
-
As I said on IRC I've got no ****ing clue why my fixes work when yours didn't. Especially since the function I moved the Mission_music[SCORE_DEBRIEF_SUCCESS] = m_debriefPass_music - 1 called update_data() anyway.
But if it works, it works and that's good enough.
-
I gave it a quick test. It saves my choices and FreeSpace plays the right music. I'd say it works very nicely. :)
-
Committed r7879.
Axem tested, even if not Axem approved. Apparently, it's not "centered". Pheh. FREDders. :D