Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fred cutscene dialog #5618

Merged
merged 8 commits into from
Nov 17, 2023
Merged
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
32 changes: 19 additions & 13 deletions code/mission/missionparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,25 +1047,31 @@ void parse_cutscenes(mission *pm)

while (!optional_string("#end"))
{
// this list should correspond to the MOVIE_* #defines
scene.type = optional_string_one_of(8,
// this list should correspond to the MOVIE_* enums
scene.type = optional_string_one_of(7,
"$Fiction Viewer Cutscene:",
"$Command Brief Cutscene:",
"$Briefing Cutscene:",
"$Pre-game Cutscene:",
"$Debriefing Cutscene:",
"$Post-debriefing Cutscene:",
"$Campaign End Cutscene:",
// this is not a #define, but a synonym for one
"$Post-briefing Cutscene:");

// no more cutscenes specified?
if (scene.type < 0)
break;

// post-briefing is the same as pre-game
if (scene.type == 7)
scene.type = MOVIE_PRE_GAME;
"$Campaign End Cutscene:");

// Didn't find one of the valid cutscene types
if (scene.type < 0) {

// $Post-briefing cutscene was added as an alias of $Pre-game cutscene when
// this section was only editable by hand. Now that there's a dialog that explains
// what each option is, we can drop the alias and quietly convert it if it's found
// for backwards compatibility. Log print just in case.
if (optional_string("$Post-briefing Cutscene:")) {
scene.type = MOVIE_PRE_GAME;
mprintf(("Found cutscene defined as '$Post-briefing Cutscene' and converted it to '$Pre-game cutscene'\n"));
} else {
// no more cutscenes specified?
break;
}
}

// get the cutscene file
stuff_string(scene.filename, F_NAME, NAME_LENGTH);
Expand Down
21 changes: 14 additions & 7 deletions code/mission/missionparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,20 @@ typedef struct support_ship_info {
} support_ship_info;

// movie type defines
#define MOVIE_PRE_FICTION 0
#define MOVIE_PRE_CMD_BRIEF 1
#define MOVIE_PRE_BRIEF 2
#define MOVIE_PRE_GAME 3
#define MOVIE_PRE_DEBRIEF 4
#define MOVIE_POST_DEBRIEF 5
#define MOVIE_END_CAMPAIGN 6
// If you add one here, you must also add a description to missioncutscenedlg.cpp for FRED
// and update the dropdown list in fred.rc for the mission cutscene dialog editor.
enum : int {
MOVIE_PRE_FICTION,
MOVIE_PRE_CMD_BRIEF,
MOVIE_PRE_BRIEF,
MOVIE_PRE_GAME,
MOVIE_PRE_DEBRIEF,
MOVIE_POST_DEBRIEF,
MOVIE_END_CAMPAIGN,

// Must always be at the end of the list
Num_movie_types
};

// defines a mission cutscene.
typedef struct mission_cutscene {
Expand Down
6 changes: 6 additions & 0 deletions code/parse/sexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33180,6 +33180,12 @@ std::pair<int, sexp_src> query_referenced_in_sexp(sexp_ref_type /*type*/, const
}
}

for (i = 0; i < static_cast<int>(The_mission.cutscenes.size()); i++) {
if (query_node_in_sexp(n, The_mission.cutscenes[i].formula)) {
return std::make_pair(i, sexp_src::MISSION_CUTSCENE);
}
}

for (j=0; j<Num_teams; j++) {
for (i=0; i<Debriefings[j].num_stages; i++) {
if (query_node_in_sexp(n, Debriefings[j].stages[i].formula)){
Expand Down
1 change: 1 addition & 0 deletions code/parse/sexp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ enum class sexp_src
WING_DEPARTURE,
EVENT,
MISSION_GOAL,
MISSION_CUTSCENE,
SHIP_ORDER,
WING_ORDER,
DEBRIEFING,
Expand Down
2 changes: 2 additions & 0 deletions fred2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ set(FRED2_SOURCES
management.h
messageeditordlg.cpp
messageeditordlg.h
missioncutscenesdlg.cpp
missioncutscenesdlg.h
missiongoalsdlg.cpp
missiongoalsdlg.h
missionnotesdlg.cpp
Expand Down
3 changes: 3 additions & 0 deletions fred2/fred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ window_data Ship_wnd_data;
window_data Wing_wnd_data;
window_data Object_wnd_data;
window_data Mission_goals_wnd_data;
window_data Mission_cutscenes_wnd_data;
window_data Messages_wnd_data;
window_data Player_wnd_data;
window_data Events_wnd_data;
Expand Down Expand Up @@ -252,6 +253,7 @@ BOOL CFREDApp::InitInstance() {
read_window("Musicplayer window", &MusPlayer_wnd_data);
read_window("Object window", &Object_wnd_data);
read_window("Mission goals window", &Mission_goals_wnd_data);
read_window("Mission cutscenes window", &Mission_cutscenes_wnd_data);
read_window("Messages window", &Messages_wnd_data);
read_window("Player window", &Player_wnd_data);
read_window("Events window", &Events_wnd_data);
Expand Down Expand Up @@ -539,6 +541,7 @@ void CFREDApp::write_ini_file(int degree) {
write_window("Musicplayer window", &MusPlayer_wnd_data);
write_window("Object window", &Object_wnd_data);
write_window("Mission goals window", &Mission_goals_wnd_data);
write_window("Mission cutscenes window", &Mission_cutscenes_wnd_data);
write_window("Messages window", &Messages_wnd_data);
write_window("Player window", &Player_wnd_data);
write_window("Events window", &Events_wnd_data);
Expand Down
1 change: 1 addition & 0 deletions fred2/fred.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ extern window_data Ship_wnd_data;
extern window_data Wing_wnd_data;
extern window_data Object_wnd_data;
extern window_data Mission_goals_wnd_data;
extern window_data Mission_cutscenes_wnd_data;
extern window_data Messages_wnd_data;
extern window_data Player_wnd_data;
extern window_data Events_wnd_data;
Expand Down
70 changes: 70 additions & 0 deletions fred2/fred.rc
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ BEGIN
MENUITEM "Command Briefing\tShift+C", 33054
MENUITEM "Fiction Viewer\tShift+F", ID_EDITORS_FICTION
MENUITEM "Volumetric Nebula", ID_EDITORS_VOLUMETRICS
MENUITEM "Mission Cutscenes", ID_EDITORS_CUTSCENES
MENUITEM "Shield System", 33033
MENUITEM "Set Global Ship Flags", 33073
MENUITEM "Voice Acting Manager", ID_EDITORS_VOICE
Expand Down Expand Up @@ -1143,6 +1144,26 @@ BEGIN
LTEXT "Team",IDC_STATIC,267,100,19,8
END

IDD_MISSION_CUTSCENES DIALOGEX 0, 0, 429, 273
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Mission Cutscenes"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
CONTROL "Tree1",IDC_CUTSCENES_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,7,221,153,WS_EX_CLIENTEDGE
COMBOBOX IDC_DISPLAY_CUTSCENE_TYPES_DROP,232,22,176,119,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_CUTSCENE_TYPE_DROP,253,92,163,108,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_CUTSCENE_NAME,253,121,163,14,ES_AUTOHSCROLL
PUSHBUTTON "New Cutscene",IDC_BUTTON_NEW_CUTSCENE,233,146,76,14,0,WS_EX_STATICEDGE
PUSHBUTTON "OK",ID_OK,331,146,44,14
PUSHBUTTON "Cancel",IDCANCEL,378,146,44,14
EDITTEXT IDC_CUTSCENE_HELP_BOX,232,36,190,31,ES_MULTILINE | ES_READONLY
LTEXT "Display Cutscene Types",IDC_STATIC,233,10,75,8,NOT WS_GROUP
LTEXT "Type",IDC_STATIC,253,83,17,8,NOT WS_GROUP
LTEXT "Filename",IDC_STATIC,253,112,29,8
GROUPBOX "Current Cutscene",IDC_STATIC,233,71,189,72
EDITTEXT IDC_HELP_BOX,13,174,416,95,ES_MULTILINE | ES_READONLY | WS_VSCROLL,WS_EX_TRANSPARENT
END

IDD_SHIP_SELECT DIALOGEX 0, 0, 204, 207
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Ship Selection"
Expand Down Expand Up @@ -2587,6 +2608,14 @@ BEGIN
BOTTOMMARGIN, 263
END

IDD_MISSION_CUTSCENES, DIALOG
BEGIN
LEFTMARGIN, 6
RIGHTMARGIN, 422
TOPMARGIN, 7
BOTTOMMARGIN, 266
END

IDD_SHIP_SELECT, DIALOG
BEGIN
LEFTMARGIN, 7
Expand Down Expand Up @@ -3049,6 +3078,41 @@ BEGIN
0
END

IDD_MISSION_CUTSCENES DLGINIT
BEGIN
IDC_DISPLAY_CUTSCENE_TYPES_DROP, 0x403, 15, 0
0x6946, 0x7463, 0x6f69, 0x206e, 0x6956, 0x7765, 0x7265, "\000"
IDC_DISPLAY_CUTSCENE_TYPES_DROP, 0x403, 17, 0
0x6f43, 0x6d6d, 0x6e61, 0x2064, 0x7242, 0x6569, 0x6966, 0x676e, "\000"
IDC_DISPLAY_CUTSCENE_TYPES_DROP, 0x403, 9, 0
0x7242, 0x6569, 0x6966, 0x676e, "\000"
IDC_DISPLAY_CUTSCENE_TYPES_DROP, 0x403, 9, 0
0x7250, 0x2d65, 0x6147, 0x656d, "\000"
IDC_DISPLAY_CUTSCENE_TYPES_DROP, 0x403, 11, 0
0x6544, 0x7262, 0x6569, 0x6966, 0x676e, "\000"
IDC_DISPLAY_CUTSCENE_TYPES_DROP, 0x403, 16, 0
0x6f50, 0x7473, 0x442d, 0x6265, 0x6972, 0x6665, 0x6e69, 0x0067,
IDC_DISPLAY_CUTSCENE_TYPES_DROP, 0x403, 13, 0
0x6143, 0x706d, 0x6961, 0x6e67, 0x4520, 0x646e, "\000"
IDC_CUTSCENE_TYPE_DROP, 0x403, 15, 0
0x6946, 0x7463, 0x6f69, 0x206e, 0x6956, 0x7765, 0x7265, "\000"
IDC_CUTSCENE_TYPE_DROP, 0x403, 17, 0
0x6f43, 0x6d6d, 0x6e61, 0x2064, 0x7242, 0x6569, 0x6966, 0x676e, "\000"
IDC_CUTSCENE_TYPE_DROP, 0x403, 9, 0
0x7242, 0x6569, 0x6966, 0x676e, "\000"
IDC_CUTSCENE_TYPE_DROP, 0x403, 9, 0
0x7250, 0x2d65, 0x6147, 0x656d, "\000"
IDC_CUTSCENE_TYPE_DROP, 0x403, 11, 0
0x6544, 0x7262, 0x6569, 0x6966, 0x676e, "\000"
IDC_CUTSCENE_TYPE_DROP, 0x403, 16, 0
0x6f50, 0x7473, 0x442d, 0x6265, 0x6972, 0x6665, 0x6e69, 0x0067,
IDC_CUTSCENE_TYPE_DROP, 0x403, 13, 0
0x6143, 0x706d, 0x6961, 0x6e67, 0x4520, 0x646e, "\000"
IDC_CUTSCENE_TYPE_DROP, 0x403, 14, 0
0x6f50, 0x7473, 0x422d, 0x6972, 0x6665, 0x6e69, 0x0067,
0
END

IDD_WING_EDITOR DLGINIT
BEGIN
IDC_WING_SPECIAL_SHIP, 0x403, 6, 0
Expand Down Expand Up @@ -3291,6 +3355,11 @@ BEGIN
0
END

IDD_MISSION_CUTSCENES AFX_DIALOG_LAYOUT
BEGIN
0
END


/////////////////////////////////////////////////////////////////////////////
//
Expand Down Expand Up @@ -3448,6 +3517,7 @@ BEGIN
ID_EDITORS_SOUND "Activates Sound Editor\nSound Editor"
ID_EDITORS_TERRAIN "Activates Terrain Editor Screen\nTerrain Editor"
ID_EDIT_DUPLICATE "Duplicate selected object(s)\nDuplicate object(s)"
ID_EDITORS_CUTSCENES "Activates Mission Cutscene Editor\nMission Cutscene Editor"
ID_MIKE_GRIDCONTROL "Gahooga!"
ID_PROPERTIES_ONE "This is Mike's prompt!"
END
Expand Down
9 changes: 9 additions & 0 deletions fred2/fredview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "ai/aigoals.h"
#include "ship/ship.h" // for ship names
#include "MissionGoalsDlg.h"
#include "MissionCutscenesDlg.h"
#include "wing.h"
#include "ship_select.h"
#include "PlayerStartEditor.h"
Expand Down Expand Up @@ -168,6 +169,7 @@ BEGIN_MESSAGE_MAP(CFREDView, CView)
ON_UPDATE_COMMAND_UI(ID_CHANGE_VIEWPOINT_FOLLOW, OnUpdateChangeViewpointFollow)
ON_COMMAND(ID_CHANGE_VIEWPOINT_FOLLOW, OnChangeViewpointFollow)
ON_COMMAND(ID_EDITORS_GOALS, OnEditorsGoals)
ON_COMMAND(ID_EDITORS_CUTSCENES, OnEditorsCutscenes)
ON_COMMAND(ID_SPEED1, OnSpeed1)
ON_COMMAND(ID_SPEED2, OnSpeed2)
ON_COMMAND(ID_SPEED5, OnSpeed5)
Expand Down Expand Up @@ -1635,6 +1637,13 @@ void CFREDView::OnEditorsGoals()
dlg.DoModal();
}

void CFREDView::OnEditorsCutscenes()
{
CMissionCutscenesDlg dlg;

dlg.DoModal();
}

void CFREDView::OnSpeed1()
{
physics_speed = 1;
Expand Down
1 change: 1 addition & 0 deletions fred2/fredview.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class CFREDView : public CView
afx_msg void OnUpdateChangeViewpointFollow(CCmdUI* pCmdUI);
afx_msg void OnChangeViewpointFollow();
afx_msg void OnEditorsGoals();
afx_msg void OnEditorsCutscenes();
afx_msg void OnSpeed1();
afx_msg void OnSpeed2();
afx_msg void OnSpeed5();
Expand Down
17 changes: 17 additions & 0 deletions fred2/management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "MessageEditorDlg.h"
#include "EventEditor.h"
#include "MissionGoalsDlg.h"
#include "MissionCutscenesDlg.h"
#include "ShieldSysDlg.h"
#include "gamesnd/eventmusic.h"
#include "DebriefingEditorDlg.h"
Expand Down Expand Up @@ -1958,6 +1959,14 @@ int reference_handler(const char *name, sexp_ref_type type, int obj)

break;

case sexp_src::MISSION_CUTSCENE:
if (The_mission.cutscenes[n].filename[0] != '\0')
sprintf(text, "mission cutscene \"%s\"", The_mission.cutscenes[n].filename);
JohnAFernandez marked this conversation as resolved.
Show resolved Hide resolved
else
sprintf(text, "mission cutscene #%d", n);

break;

case sexp_src::DEBRIEFING:
sprintf(text, "debriefing #%d", n);
break;
Expand Down Expand Up @@ -2160,6 +2169,14 @@ int sexp_reference_handler(int node, sexp_src source, int source_index, char *ms
break;
}

case sexp_src::MISSION_CUTSCENE: {
CMissionCutscenesDlg dlg;

dlg.select_sexp_node = node;
dlg.DoModal();
break;
}

case sexp_src::DEBRIEFING: {
debriefing_editor_dlg dlg;

Expand Down
Loading
Loading