[Scummvm-git-logs] scummvm master -> 096eaa6e54b2aebe62f7fb0e82a865566a37c008

dreammaster noreply at scummvm.org
Mon Jul 6 10:14:08 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
096eaa6e54 MADS: DRAGONSPHERE: Don't stop music between segments of intro


Commit: 096eaa6e54b2aebe62f7fb0e82a865566a37c008
    https://github.com/scummvm/scummvm/commit/096eaa6e54b2aebe62f7fb0e82a865566a37c008
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-07-06T20:14:01+10:00

Commit Message:
MADS: DRAGONSPHERE: Don't stop music between segments of intro

Changed paths:
    engines/mads/madsv2/animview/animview.cpp
    engines/mads/madsv2/animview/animview.h
    engines/mads/madsv2/animview/functions.cpp


diff --git a/engines/mads/madsv2/animview/animview.cpp b/engines/mads/madsv2/animview/animview.cpp
index d35abd7d6d3..c9123c2e2c4 100644
--- a/engines/mads/madsv2/animview/animview.cpp
+++ b/engines/mads/madsv2/animview/animview.cpp
@@ -69,6 +69,8 @@ CycleList anim_cycle_list;
 bool has_cycles;
 int currentViewX, currentViewY;
 int concat_mode;
+bool stop_music_at_end;
+bool wait_for_music_at_end;
 
 static const byte FX_TIMES[16] = {
 	0, 110, 110, 64, 64, 64, 64, 64, 64, 64, 64, 0, 0, 0
@@ -96,7 +98,6 @@ static bool hasAnimInited;
 static int runVal1, runVal2, runVal3;
 static int runVal12;
 static int error_code;
-bool wait_for_music_at_end;
 
 /**
  * Initializes animview global variables
@@ -388,6 +389,7 @@ static void animate() {
 	int soundLoadFlag = 0;
 	int imageIndex;
 	static int packIndex = 0;
+	bool found_sound = false;
 
 	himem_startup();
 	(void)tile_setup();
@@ -452,9 +454,10 @@ static void animate() {
 
 			Common::String name(sound_file_name);
 			has_sound_file = !name.empty() && Common::isDigit(name.lastChar());
+			found_sound = true;
 		}
 
-		if (has_sound_file) {
+		if ((!stop_music_at_end || found_sound) && !g_engine->_soundManager->isLoaded()) {
 			// Initialize the sound driver
 			int section = sound_file_name[strlen(sound_file_name) - 1] - '0';
 			g_engine->_soundManager->init(section);
@@ -569,9 +572,13 @@ static void animate() {
 
 		minFrame = maxFrame = -1;
 
-		// Free the allocated sound driver
-		g_engine->_soundManager->closeDriver();
-		has_sound_file = false;
+		if (has_sound_file && stop_music_at_end) {
+			// Free the allocated sound driver
+			g_engine->_soundManager->closeDriver();
+		}
+
+		if (stop_music_at_end && found_sound)
+			has_sound_file = false;
 
 		// Free surface
 		buffer_free(&scr_work);
@@ -594,6 +601,9 @@ done:
 		mem_free(room);
 	timer_set_sound_flag(false);
 
+	if (g_engine->_soundManager->isLoaded())
+		g_engine->_soundManager->removeDriver();
+
 	timer_remove();
 	himem_shutdown();
 }
diff --git a/engines/mads/madsv2/animview/animview.h b/engines/mads/madsv2/animview/animview.h
index 9874de480e2..9c585b693be 100644
--- a/engines/mads/madsv2/animview/animview.h
+++ b/engines/mads/madsv2/animview/animview.h
@@ -54,6 +54,7 @@ extern bool has_cycles;
 extern int currentViewX, currentViewY;
 extern int concat_mode;
 extern bool wait_for_music_at_end;
+extern bool stop_music_at_end;
 
 // Main animview function
 extern void animview_main(const char *resName);
diff --git a/engines/mads/madsv2/animview/functions.cpp b/engines/mads/madsv2/animview/functions.cpp
index 237e6f4a4bb..36db30adf46 100644
--- a/engines/mads/madsv2/animview/functions.cpp
+++ b/engines/mads/madsv2/animview/functions.cpp
@@ -81,6 +81,10 @@ void add_anim(const char *name) {
 void flag_parse(const char *param) {
 	char c = tolower(*param++);
 	switch (c) {
+	case 'd':
+		stop_music_at_end = true;
+		break;
+
 	case 'j':
 		wait_for_music_at_end = true;
 		break;




More information about the Scummvm-git-logs mailing list