View Issue Details

IDProjectCategoryView StatusLast Update
0003024FSSCPsoundpublic2014-03-26 01:53
ReporterYarn Assigned ToYarn  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx64OSWindows 7 
Product Version3.7.1 
Summary0003024: [patch] Prevent debriefing music from switching to an invalid track
DescriptionGoober asked me to post this here. Currently, if a mission specifies debriefing tracks, the game tries to use those for the debriefing, even if they don't exist in the music tables, resulting in silence. The attached patch fixes this by assigning debriefing tracks only if 1) they exist in the music tables and 2) the music files themselves exist (although the latter is not required in FRED).

(For reference, retail FS2 switches the first briefing track, not silence, in this case.)
TagsNo tags attached.

Activities

Yarn

2014-03-24 18:12

developer  

DebriefingFix.patch (1,434 bytes)   
Index: code/mission/missionparse.cpp
===================================================================
--- code/mission/missionparse.cpp	(revision 10507)
+++ code/mission/missionparse.cpp	(working copy)
@@ -1117,7 +1117,10 @@
 	if (optional_string("$Debriefing Success Music:"))
 	{
 		stuff_string(temp, F_NAME, NAME_LENGTH);
-		event_music_set_score(SCORE_DEBRIEF_SUCCESS, temp);
+		index = event_music_get_spooled_music_index(temp);
+		if ((index >= 0) && ((Spooled_music[index].flags & SMF_VALID) || Fred_running)) {
+			event_music_set_score(SCORE_DEBRIEF_SUCCESS, temp);
+		}
 	}
 
 	// not old, just added since it makes sense
@@ -1124,7 +1127,10 @@
 	if (optional_string("$Debriefing Average Music:"))
 	{
 		stuff_string(temp, F_NAME, NAME_LENGTH);
-		event_music_set_score(SCORE_DEBRIEF_AVERAGE, temp);
+		index = event_music_get_spooled_music_index(temp);
+		if ((index >= 0) && ((Spooled_music[index].flags & SMF_VALID) || Fred_running)) {
+			event_music_set_score(SCORE_DEBRIEF_AVERAGE, temp);
+		}
 	}
 
 	// old stuff
@@ -1131,7 +1137,10 @@
 	if (optional_string("$Debriefing Fail Music:"))
 	{
 		stuff_string(temp, F_NAME, NAME_LENGTH);
-		event_music_set_score(SCORE_DEBRIEF_FAIL, temp);
+		index = event_music_get_spooled_music_index(temp);
+		if ((index >= 0) && ((Spooled_music[index].flags & SMF_VALID) || Fred_running)) {
+			event_music_set_score(SCORE_DEBRIEF_FAIL, temp);
+		}
 	}
 
 	// new stuff
DebriefingFix.patch (1,434 bytes)   

Goober5000

2014-03-26 01:53

administrator   ~0015686

Fix committed to trunk@10531.

Goober5000

2014-03-26 01:53

administrator   ~0015687

Patch reviewed by me and tested by Yarn. Crediting Yarn for spotting the bug as well as fixing it.

Related Changesets

fs2open: trunk r10531

2014-03-25 20:57

Goober5000


Ported: N/A

Details Diff
Yarn's fix for Mantis 0003024 Affected Issues
0003024
mod - /trunk/fs2_open/code/mission/missionparse.cpp Diff File

Issue History

Date Modified Username Field Change
2014-03-24 18:12 Yarn New Issue
2014-03-24 18:12 Yarn File Added: DebriefingFix.patch
2014-03-26 01:53 Goober5000 Changeset attached => fs2open trunk r10531
2014-03-26 01:53 Goober5000 Note Added: 0015686
2014-03-26 01:53 Goober5000 Status new => resolved
2014-03-26 01:53 Goober5000 Resolution open => fixed
2014-03-26 01:53 Goober5000 Note Added: 0015687
2014-03-26 01:53 Goober5000 Assigned To => Yarn