[Scummvm-git-logs] scummvm master -> 5e8486c088b1d1338f32815aea846beab1c08111

dreammaster noreply at scummvm.org
Sun Aug 9 09:26:24 UTC 2026


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

Summary:
81949c8024 MADS: NEBULAR: Fix text display in intro for floppy version speech
5e8486c088 MADS: NEBULAR: Implement speech playback for intro


Commit: 81949c80249daee470c6d7dbfc24c89820f5d148
    https://github.com/scummvm/scummvm/commit/81949c80249daee470c6d7dbfc24c89820f5d148
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-09T19:26:14+10:00

Commit Message:
MADS: NEBULAR: Fix text display in intro for floppy version speech

Changed paths:
    engines/mads/animview/anim_timer.cpp
    engines/mads/animview/animview.cpp
    engines/mads/animview/animview.h


diff --git a/engines/mads/animview/anim_timer.cpp b/engines/mads/animview/anim_timer.cpp
index 70f8acfc19e..8999af782be 100644
--- a/engines/mads/animview/anim_timer.cpp
+++ b/engines/mads/animview/anim_timer.cpp
@@ -113,9 +113,11 @@ void anim_timer() {
 		goto block2;
 
 	speech = &current_anim->speech[speechIndex];
-	flag = speech->display_condition != 0x4000 &&
-		speech->display_condition != 0x800 &&
-		speech->resource_id >= 0;
+	if (speech_lines_count > 0) {
+		flag = speech->display_condition != 0x4000 &&
+			speech->display_condition != 0x800 &&
+			speech->resource_id >= 0;
+	}
 
 	if (g_engine->getGameID() != GType_RexNebular) {
 		// In Phantom sound_dma is one of the sound card params which can be configurable via flags.
diff --git a/engines/mads/animview/animview.cpp b/engines/mads/animview/animview.cpp
index 026fc89918d..6d6ae573937 100644
--- a/engines/mads/animview/animview.cpp
+++ b/engines/mads/animview/animview.cpp
@@ -70,10 +70,7 @@ 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
-//};
+int speech_lines_count;
 
 static bool has_sound_file;
 static char sound_file_name[80];
@@ -83,7 +80,6 @@ static Room *room;
 static int viewing_at_y2;
 constexpr int SPEECH_LINES_COUNT = 10;
 static Audio::AudioStream *speech_lines[SPEECH_LINES_COUNT];
-static int speech_lines_count;
 static SeriesPtr animSeries;
 static SpritePageInfoPtr pageInfo;
 static SpritePageTablePtr pageTable;
@@ -201,7 +197,7 @@ static void run_animation(int animIndex) {
 	loadFontFlag = (current_anim->load_flags & AA_LOAD_FONT) != 0;
 
 	speechLoops = runVal6 = runVal7 = runVal8 = 0;
-	speechStream = 0;
+	speechStream = nullptr;
 	timerFlag1 = false;
 
 	if (current_anim->background_type == AA_INTERFACE) {
diff --git a/engines/mads/animview/animview.h b/engines/mads/animview/animview.h
index 84aacc4c578..35a26ba6d7f 100644
--- a/engines/mads/animview/animview.h
+++ b/engines/mads/animview/animview.h
@@ -54,6 +54,8 @@ extern int currentViewX, currentViewY;
 extern int concat_mode;
 extern bool wait_for_music_at_end;
 extern bool stop_music_at_end;
+extern int speech_lines_count;
+
 
 // Main animview function
 extern void animview_main(const char *resName);


Commit: 5e8486c088b1d1338f32815aea846beab1c08111
    https://github.com/scummvm/scummvm/commit/5e8486c088b1d1338f32815aea846beab1c08111
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-09T19:26:14+10:00

Commit Message:
MADS: NEBULAR: Implement speech playback for intro

Changed paths:
    engines/mads/animview/anim_timer.cpp
    engines/mads/animview/animview.cpp
    engines/mads/animview/animview.h
    engines/mads/core/anim.cpp
    engines/mads/core/anim.h


diff --git a/engines/mads/animview/anim_timer.cpp b/engines/mads/animview/anim_timer.cpp
index 8999af782be..d34b4c3a49d 100644
--- a/engines/mads/animview/anim_timer.cpp
+++ b/engines/mads/animview/anim_timer.cpp
@@ -64,7 +64,7 @@ void anim_timer() {
 	Frame *frame;
 	int sound, count;
 
-	if (current_error_code || speechStream)
+	if (current_error_code || speechResourceId != -1)
 		goto done;
 	if (currentFrame < 0 || currentFrame >= maxFrame)
 		goto done;
@@ -113,7 +113,7 @@ void anim_timer() {
 		goto block2;
 
 	speech = &current_anim->speech[speechIndex];
-	if (speech_lines_count > 0) {
+	if (hasSpeechAudio) {
 		flag = speech->display_condition != 0x4000 &&
 			speech->display_condition != 0x800 &&
 			speech->resource_id >= 0;
@@ -129,7 +129,7 @@ void anim_timer() {
 	}
 
 	if (flag) {
-		speechStream = speech->speech;
+		speechResourceId = speech->resource_id;
 		speechFlags = speech->flags;
 		goto done;
 	}
diff --git a/engines/mads/animview/animview.cpp b/engines/mads/animview/animview.cpp
index 6d6ae573937..d07124185ae 100644
--- a/engines/mads/animview/animview.cpp
+++ b/engines/mads/animview/animview.cpp
@@ -45,7 +45,6 @@ namespace AnimView {
 
 constexpr bool in_mads_mode = true;
 
-Audio::AudioStream *speechStream;
 int speechFlags;
 int current_error_code;
 int currentFrame;
@@ -70,7 +69,8 @@ int currentViewX, currentViewY;
 int concat_mode;
 bool stop_music_at_end;
 bool wait_for_music_at_end;
-int speech_lines_count;
+bool hasSpeechAudio;
+int speechResourceId;
 
 static bool has_sound_file;
 static char sound_file_name[80];
@@ -78,8 +78,6 @@ static TileResource picture_res, depth_res;
 static Buffer scr_work_orig;
 static Room *room;
 static int viewing_at_y2;
-constexpr int SPEECH_LINES_COUNT = 10;
-static Audio::AudioStream *speech_lines[SPEECH_LINES_COUNT];
 static SeriesPtr animSeries;
 static SpritePageInfoPtr pageInfo;
 static SpritePageTablePtr pageTable;
@@ -113,8 +111,8 @@ static void init_globals() {
 	current_anim_inter = nullptr;
 	has_cycles = false;
 	viewing_at_y2 = 0;
-	memset(speech_lines, 0, sizeof(speech_lines));
-	speech_lines_count = 0;
+	hasSpeechAudio = false;
+	speechResourceId = -1;
 	animSeries = nullptr;
 	pageInfo = nullptr;
 	pageTable = nullptr;
@@ -134,7 +132,6 @@ static void init_globals() {
 	runVal2 = runVal3 = -1;
 	speechIndex = speechLoops = runVal6 = 0;
 	runVal7 = runVal8 = 0;
-	speechStream = nullptr;
 	timerFlag1 = false;
 	runVal12 = 0;
 	loadFontFlag = 0;
@@ -149,6 +146,8 @@ static void init_globals() {
 }
 
 static void anim_inter_timer() {
+	// This doesn't seem to be ever used, so I didn't implement it. It seems to be
+	// for the alternate "interface" style of animations
 	error("TODO: Inter anim timer");
 }
 
@@ -197,7 +196,6 @@ static void run_animation(int animIndex) {
 	loadFontFlag = (current_anim->load_flags & AA_LOAD_FONT) != 0;
 
 	speechLoops = runVal6 = runVal7 = runVal8 = 0;
-	speechStream = nullptr;
 	timerFlag1 = false;
 
 	if (current_anim->background_type == AA_INTERFACE) {
@@ -226,17 +224,16 @@ static void run_animation(int animIndex) {
 
 	// Main animation loop
 	while (currentFrame < maxFrame && !current_error_code) {
-		if (speechStream) {
+		if (speechResourceId != -1) {
 			if (current_anim->load_flags & AA_LOAD_SPEECH) {
-				//char speechName[80];
-				//MADS_FORMAT(speechName, current_anim->speech_file);
+				char buf[80];
+				MADS_FORMAT(buf, current_anim->speech_file);
 
-				g_engine->playSpeech(speechStream);
-				//speech_play(speechName, speechStream);
+				speech_play(buf, speechResourceId);
 			}
 
 			timerFlag1 = true;
-			speechStream = 0;
+			speechResourceId = -1;
 		}
 
 		if (foundSeries && seriesMinFrame < seriesMaxFrame) {
@@ -512,18 +509,15 @@ static void animate() {
 		buffer_fill(scr_work, 0);
 
 		// Speech handling
-		speech_lines_count = 0;
-		for (ctr = 0; ctr < current_anim->num_speech; ++ctr) {
-			Speech &speech = current_anim->speech[ctr];
-			speech.speech = nullptr;
+		hasSpeechAudio = false;
+		speechResourceId = -1;
 
-			if ((speech.flags & 0x2000) && speech_lines_count < SPEECH_LINES_COUNT) {
+		for (ctr = 0; ctr < current_anim->num_speech && !hasSpeechAudio; ++ctr) {
+			Speech &speech = current_anim->speech[ctr];
+			if (g_engine->getGameID() == GType_RexNebular || (speech.flags & 0x2000)) {
 				// Load the speech audio
 				MADS_FORMAT(buf, current_anim->speech_file);
-				speech_lines[speech_lines_count] = speech.speech =
-					speech_load(buf, speech.resource_id);
-
-				++speech_lines_count;
+				hasSpeechAudio = *current_anim->speech_file && env_exist(buf);
 			}
 		}
 
@@ -562,10 +556,8 @@ static void animate() {
 		// Run the animation
 		run_animation(count);
 
-		for (auto &line : speech_lines) {
-			mem_free(line);
-			line = nullptr;
-		}
+		// Stop any speech
+		speech_all_off();
 
 		mem_free(largeBuffer);
 		largeBuffer = nullptr;
diff --git a/engines/mads/animview/animview.h b/engines/mads/animview/animview.h
index 35a26ba6d7f..1b8b5f3fb99 100644
--- a/engines/mads/animview/animview.h
+++ b/engines/mads/animview/animview.h
@@ -30,7 +30,6 @@ namespace MADS {
 namespace AnimView {
 
 // Variables shared with other AnimView namespace files
-extern Audio::AudioStream *speechStream;
 extern int speechFlags;
 extern int current_error_code;
 extern int currentFrame, minFrame, maxFrame;
@@ -54,8 +53,8 @@ extern int currentViewX, currentViewY;
 extern int concat_mode;
 extern bool wait_for_music_at_end;
 extern bool stop_music_at_end;
-extern int speech_lines_count;
-
+extern bool hasSpeechAudio;
+extern int speechResourceId;
 
 // Main animview function
 extern void animview_main(const char *resName);
diff --git a/engines/mads/core/anim.cpp b/engines/mads/core/anim.cpp
index f349fdf2733..f5a886e3a4e 100644
--- a/engines/mads/core/anim.cpp
+++ b/engines/mads/core/anim.cpp
@@ -64,7 +64,6 @@ void Speech::load(Common::SeekableReadStream *src) {
 	src->read(misc, 3);
 	src->readMultipleLE(sound);
 
-	speech = nullptr;
 	src->skip(4);
 
 	src->readMultipleLE(x, y, display_condition);
diff --git a/engines/mads/core/anim.h b/engines/mads/core/anim.h
index c5cf87b75f3..b6eefc415c2 100644
--- a/engines/mads/core/anim.h
+++ b/engines/mads/core/anim.h
@@ -312,7 +312,6 @@ struct Speech {
 	char text[60];                /* Text to be displayed     */
 	byte misc[3];                 /* 3 extra bonus bytes      */
 	byte sound;                   /* Sound to be used         */
-	Audio::AudioStream *speech;	  /* Speech audio stream      */
 	int16 x, y;                   /* Text coordinates         */
 	uint16 display_condition;     /* Condition for display    */
 	RGBcolor color[2];            /* Colors for text display  */




More information about the Scummvm-git-logs mailing list