[Scummvm-git-logs] scummvm master -> 301a432c34c9a6ff177052c9aed81678b7b403f1

dreammaster noreply at scummvm.org
Fri Aug 14 10:35:08 UTC 2026


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

Summary:
d41c7de3be MADS: NEBULAR: Fix overshadow warnings in Mac sound code
7bf14d01e7 MADS: Animview cleanups. PVS-Studio V557, V519, V581
345542f158 MADS: Fix dodgy pointer cast in anim. PVS-Studio V1032
6ce45eafb5 MADS: Fix PVS-Studio warnings. PVS-Studio V557, V560
73013427f2 MADS: Remove unused color code
301a432c34 MADS: NEBULAR: Fix shadowed globals warnings in Mac dialog code


Commit: d41c7de3be93a4b6dd4ea41e48f4c7f2734e8677
    https://github.com/scummvm/scummvm/commit/d41c7de3be93a4b6dd4ea41e48f4c7f2734e8677
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-14T16:39:12+10:00

Commit Message:
MADS: NEBULAR: Fix overshadow warnings in Mac sound code

Changed paths:
    engines/mads/nebular/sound/mac_sound.cpp
    engines/mads/nebular/sound/mac_sound.h


diff --git a/engines/mads/nebular/sound/mac_sound.cpp b/engines/mads/nebular/sound/mac_sound.cpp
index cd6d05f0e12..80d4aa39519 100644
--- a/engines/mads/nebular/sound/mac_sound.cpp
+++ b/engines/mads/nebular/sound/mac_sound.cpp
@@ -427,13 +427,13 @@ void MacSoundManager::startQueuedCommands() {
 		getMacintoshDriver()->dispatchQueue();
 }
 
-void MacSoundManager::commandMacintosh(const MacSoundCommand &command, bool queued) {
+void MacSoundManager::commandMacintosh(const MacSoundCommand &cmd, bool queued) {
 	if (!_driver || !_soundFlag)
 		return;
 	if (queued)
-		getMacintoshDriver()->queueMacintosh(command);
+		getMacintoshDriver()->queueMacintosh(cmd);
 	else
-		getMacintoshDriver()->commandMacintosh(command);
+		getMacintoshDriver()->commandMacintosh(cmd);
 }
 
 void MacSoundManager::service(uint32 tick) {
@@ -441,24 +441,24 @@ void MacSoundManager::service(uint32 tick) {
 		getMacintoshDriver()->service(tick);
 }
 
-bool commandMacintoshSound(const MacSoundCommand &command, bool queued) {
+bool commandMacintoshSound(const MacSoundCommand &cmd, bool queued) {
 	if (!g_engine || g_engine->getPlatform() != Common::kPlatformMacintosh ||
 			!g_engine->_soundManager)
 		return false;
 	static_cast<MacSoundManager *>(g_engine->_soundManager)->commandMacintosh(
-		command, queued);
+		cmd, queued);
 	return true;
 }
 
 bool commandMacintoshSound(MacSoundOperation operation, int resourceID,
 		int argument1, int argument2, int argument3, bool queued) {
-	MacSoundCommand command;
-	command.operation = operation;
-	command.resourceID = resourceID;
-	command.argument1 = argument1;
-	command.argument2 = argument2;
-	command.argument3 = argument3;
-	return commandMacintoshSound(command, queued);
+	MacSoundCommand cmd;
+	cmd.operation = operation;
+	cmd.resourceID = resourceID;
+	cmd.argument1 = argument1;
+	cmd.argument2 = argument2;
+	cmd.argument3 = argument3;
+	return commandMacintoshSound(cmd, queued);
 }
 
 } // namespace Sound
diff --git a/engines/mads/nebular/sound/mac_sound.h b/engines/mads/nebular/sound/mac_sound.h
index 89f27080f7b..fbb28536f27 100644
--- a/engines/mads/nebular/sound/mac_sound.h
+++ b/engines/mads/nebular/sound/mac_sound.h
@@ -128,11 +128,11 @@ public:
 
 	void validate() override {}
 	void startQueuedCommands() override;
-	void commandMacintosh(const MacSoundCommand &command, bool queued);
+	void commandMacintosh(const MacSoundCommand &cmd, bool queued);
 	void service(uint32 tick);
 };
 
-bool commandMacintoshSound(const MacSoundCommand &command, bool queued = false);
+bool commandMacintoshSound(const MacSoundCommand &cmd, bool queued = false);
 bool commandMacintoshSound(MacSoundOperation operation, int resourceID,
 	int argument1 = 0, int argument2 = 0, int argument3 = 0,
 	bool queued = false);


Commit: 7bf14d01e7b876c4a210f4d1a39dfb149d0d95ac
    https://github.com/scummvm/scummvm/commit/7bf14d01e7b876c4a210f4d1a39dfb149d0d95ac
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-14T20:20:01+10:00

Commit Message:
MADS: Animview cleanups. PVS-Studio V557, V519, V581

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


diff --git a/engines/mads/animview/anim_timer.cpp b/engines/mads/animview/anim_timer.cpp
index dedb6f6727b..066b937a8e4 100644
--- a/engines/mads/animview/anim_timer.cpp
+++ b/engines/mads/animview/anim_timer.cpp
@@ -65,10 +65,10 @@ void anim_timer_init() {
 	paletteHandle = 0;
 	palIndex1 = palIndex2 = 0;
 	matteId = 0;
-	normalTimer1 = messageCount = 0;
+	normalTimer1 = 0;
 	currentViewX = currentViewY = 0;
 	panningX = panningY = 0;
-	normalTimer1 = imageCount = 0;
+	messageCount = imageCount = 0;
 }
 
 void anim_timer_shutdown() {
diff --git a/engines/mads/animview/animview.cpp b/engines/mads/animview/animview.cpp
index d5cca961c68..3af8b2f9f99 100644
--- a/engines/mads/animview/animview.cpp
+++ b/engines/mads/animview/animview.cpp
@@ -290,10 +290,8 @@ static void run_animation(int animIndex) {
 			if (seriesFlag2 && currentFrame <= seriesMinFrame && !picture_map.one_to_one)
 				flag1 = false;
 
-			if (flag1)
-				seriesFlag2 = false;
-
 			if (flag1) {
+				seriesFlag2 = false;
 				(void)sprite_data_load(animSeries, frameIndex, largeBuffer2);
 				largeBuffer2 += pageMemNeeded;
 				++seriesMinFrame;
@@ -478,7 +476,7 @@ static void animate() {
 
 		if ((!stop_music_at_end || found_sound) && !g_engine->_soundManager->isLoaded()) {
 			// Initialize the sound driver
-			char ext = sound_file_name[strlen(sound_file_name) - 1];
+			char ext = strlen(sound_file_name) > 0 ? sound_file_name[strlen(sound_file_name) - 1] : '0';
 			int section = (g_engine->isDemo() && !Common::isDigit(ext)) ? 1 : ext - '0';
 			g_engine->_soundManager->init(section);
 		}


Commit: 345542f158bb67661f98ede2b3c32f55c56cad02
    https://github.com/scummvm/scummvm/commit/345542f158bb67661f98ede2b3c32f55c56cad02
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-14T20:25:08+10:00

Commit Message:
MADS: Fix dodgy pointer cast in anim. PVS-Studio V1032

Changed paths:
    engines/mads/core/anim.cpp


diff --git a/engines/mads/core/anim.cpp b/engines/mads/core/anim.cpp
index 3ecd5492f1f..af3b267d9a3 100644
--- a/engines/mads/core/anim.cpp
+++ b/engines/mads/core/anim.cpp
@@ -230,7 +230,7 @@ AnimPtr anim_load(const char *file_name, Buffer *orig, Buffer *depth,
 	char temp_buf[80];
 	char block_name[20];
 	char *mark;
-	int16 *color_slaves = (int16 *)temp_buf;
+	int16 color_slaves[40];
 	word num_color_slaves;
 	long image_size, frame_size, speech_size, anim_size;
 	AnimPtr anim = NULL;


Commit: 6ce45eafb5fef3e03b71e19cc1ca19746ac5589d
    https://github.com/scummvm/scummvm/commit/6ce45eafb5fef3e03b71e19cc1ca19746ac5589d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-14T20:32:12+10:00

Commit Message:
MADS: Fix PVS-Studio warnings. PVS-Studio V557, V560

Changed paths:
    engines/mads/core/attr.cpp
    engines/mads/core/buffer.cpp


diff --git a/engines/mads/core/attr.cpp b/engines/mads/core/attr.cpp
index a5a73f93eea..20d77e18bad 100644
--- a/engines/mads/core/attr.cpp
+++ b/engines/mads/core/attr.cpp
@@ -171,7 +171,7 @@ int attr_load(char *base_name,
 	env_catint(temp_buf, variant, 1);
 
 	if (!env_exist(temp_buf)) {
-		if (variant > 0) {
+		if (variant > 0 && strlen(temp_buf) != 0) {
 			temp_buf[strlen(temp_buf) - 1] = '0';
 		}
 
diff --git a/engines/mads/core/buffer.cpp b/engines/mads/core/buffer.cpp
index daede74db7b..d96f98710ba 100644
--- a/engines/mads/core/buffer.cpp
+++ b/engines/mads/core/buffer.cpp
@@ -726,7 +726,7 @@ void buffer_peel_vert(Buffer *target, int peel, byte *work_memory, long work_siz
 		memcpy(deep_scan, work_area, peel_memory);
 	}
 
-	if (work_area != NULL && work_memory == NULL)
+	if (work_memory == NULL)
 		mem_free(work_area);
 }
 


Commit: 73013427f2731ba5f5f885a884c0929701e8bb25
    https://github.com/scummvm/scummvm/commit/73013427f2731ba5f5f885a884c0929701e8bb25
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-14T20:33:07+10:00

Commit Message:
MADS: Remove unused color code

Changed paths:
    engines/mads/core/color.cpp
    engines/mads/core/color.h


diff --git a/engines/mads/core/color.cpp b/engines/mads/core/color.cpp
index 8ab0e13431b..1ed5d9b670e 100644
--- a/engines/mads/core/color.cpp
+++ b/engines/mads/core/color.cpp
@@ -91,168 +91,6 @@ void color_list_start_scan(byte *list_flags) {
 	}
 }
 
-int color_list_update(ColorListPtr list, Buffer *scan_buf, Palette *scan_pal, byte *list_flags, byte *palette_map, CycleListPtr cycle) {
-	int count;
-	int row, col;
-	int found;
-	int result;
-	int hi, lo;
-	int num;
-	int cycle_color;
-	int cycle_count;
-	byte color_flags[256];
-	byte *scan;
-	byte color;
-	byte r, g, b;
-	word cycle_value;
-	word value[256];
-	byte reverse_map[256] = { 0 };
-	ColorList temp_list;
-
-	result = 0;
-
-	for (count = 0; count <= COLOR_HIGHEST; count++) {
-		color_flags[count] = (byte)false;
-	}
-
-	for (count = COLOR_HIGHEST + 1; count < 256; count++) {
-		color_flags[count] = (byte)true;
-	}
-
-	// First, deal with any colors involved in cycling
-	if (cycle != NULL) {
-		for (cycle_count = 0; cycle_count < cycle->num_cycles; cycle_count++) {
-			lo = cycle->table[cycle_count].first_palette_color;
-			num = cycle->table[cycle_count].num_colors;
-			hi = lo + num - 1;
-			for (cycle_color = lo; cycle_color <= hi; cycle_color++) {
-				if (!color_flags[cycle_color]) {
-					color_flags[cycle_color] = true;
-					r = (*scan_pal)[cycle_color].r;
-					g = (*scan_pal)[cycle_color].g;
-					b = (*scan_pal)[cycle_color].b;
-					found = false;
-					
-					if (!found) {
-						if (list->num_colors < COLOR_MAX_USER_COLORS) {
-							count = list->num_colors;
-							list->table[count].r = r;
-							list->table[count].g = g;
-							list->table[count].b = b;
-							list->table[count].x16 = (byte)COLOR_NO_X16;
-							list->table[count].cycle = (byte)(cycle_count + 1);
-							list->table[count].group = 0;
-							list_flags[count] = true;
-							if (palette_map != NULL) {
-								palette_map[cycle_color] = (byte)count;
-							}
-							reverse_map[count] = (byte)cycle_color;
-							list->num_colors++;
-						} else {
-							result = COLOR_ERR_LISTOVERFLOW;
-						}
-					}
-				}
-			}
-		}
-	}
-
-	// Now deal with any other colors used in the picture
-	scan = (byte *)mem_normalize(scan_buf->data);
-
-	for (row = 0; row < scan_buf->y; row++) {
-		for (col = 0; col < scan_buf->x; col++) {
-			color = *scan;
-			if (!color_flags[color]) {
-				r = (*scan_pal)[color].r;
-				g = (*scan_pal)[color].g;
-				b = (*scan_pal)[color].b;
-				found = false;
-				for (count = 0; (count < list->num_colors) && (!found); count++) {
-					if ((r == list->table[count].r) &&
-						(g == list->table[count].g) &&
-						(b == list->table[count].b) &&
-						(list->table[count].cycle == 0)) {
-						found = true;
-						list_flags[count] = true;
-						if (palette_map != NULL) {
-							palette_map[color] = (byte)count;
-						}
-						reverse_map[count] = color;
-					}
-				}
-				if (!found) {
-					if (list->num_colors < COLOR_MAX_USER_COLORS) {
-						count = list->num_colors;
-						list->table[count].r = r;
-						list->table[count].g = g;
-						list->table[count].b = b;
-						list->table[count].x16 = (byte)COLOR_NO_X16;
-						list->table[count].cycle = 0;
-						list->table[count].group = 0;
-						list_flags[count] = true;
-						if (palette_map != NULL) {
-							palette_map[color] = (byte)count;
-						}
-						reverse_map[count] = color;
-						list->num_colors++;
-					} else {
-						result = COLOR_ERR_LISTOVERFLOW;
-					}
-				}
-				color_flags[color] = (byte)true;
-			}
-			scan++;
-		}
-		scan = (byte *)mem_check_overflow(scan);
-	}
-
-	// Sort color list so that cycle colors appear first
-	// The various tables must also be corrected.
-	if (cycle != NULL) {
-		for (count = 0; count < list->num_colors; count++) {
-			cycle_value = list->table[count].cycle;
-			if ((cycle_value == 0) || (!list_flags[count])) cycle_value = 100;
-			value[count] = (cycle_value << 8) + reverse_map[count];
-			color_flags[count] = (byte)count;
-		}
-		sort_insertion_16(list->num_colors, color_flags, value);
-		temp_list.num_colors = list->num_colors;
-		for (count = 0; count < list->num_colors; count++) {
-			memcpy(&temp_list.table[count], &list->table[color_flags[count]], sizeof(Color));
-		}
-		if (palette_map != NULL) {
-			for (count = 0; count < 256; count++) {
-				palette_map[count] = color_flags[palette_map[count]];
-			}
-		}
-		for (count = 0; count < list->num_colors; count++) {
-			value[count] = list_flags[count];
-		}
-		for (count = 0; count < list->num_colors; count++) {
-			list_flags[count] = (byte)value[color_flags[count]];
-		}
-		memcpy(list, &temp_list, sizeof(ColorList));
-
-		// Switch cycle list color #'s from palette to list
-		for (cycle_count = 0; cycle_count < cycle->num_cycles; cycle_count++) {
-			found = false;
-			for (count = 0; !found && (count < list->num_colors); count++) {
-				if (list->table[count].cycle == (byte)(cycle_count + 1)) {
-					found = true;
-					cycle->table[cycle_count].first_list_color = (byte)count;
-				}
-			}
-		}
-	}
-
-	if (result == 0) {
-		result = list->num_colors;
-	}
-
-	return result;
-}
-
 int color_list_purge(ColorListPtr list, byte *list_flags) {
 	int count, count2;
 
diff --git a/engines/mads/core/color.h b/engines/mads/core/color.h
index aff8a12ea71..363119d437a 100644
--- a/engines/mads/core/color.h
+++ b/engines/mads/core/color.h
@@ -140,18 +140,6 @@ typedef ShadowList *ShadowListPtr;
 extern byte color_thatch(int color, int thatching);
 extern void color_list_start_scan(byte *list_flags);
 
-/**
- * Updates a color list <list>, based on colors used in <scan_buf>
- * and defined in <scan_pal>.  Adds any colors used in picture but
- * not defined in list to the list; sets the corresponding color flag
- * for each color that is used in the buffer.
- *
- * @return		Returns # of colors in updated list, or negative for error.
- */
-extern int color_list_update(ColorListPtr list, Buffer *scan_buf,
-	Palette *scan_pal, byte *list_flags,
-	byte *palette_map, CycleListPtr cycle);
-
 /**
  * Removes from color list "list" any colors whose corresponding
  * flags are not set.  (Use after color_list_update to remove colors


Commit: 301a432c34c9a6ff177052c9aed81678b7b403f1
    https://github.com/scummvm/scummvm/commit/301a432c34c9a6ff177052c9aed81678b7b403f1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-08-14T20:34:45+10:00

Commit Message:
MADS: NEBULAR: Fix shadowed globals warnings in Mac dialog code

Changed paths:
    engines/mads/nebular/mac_dialogs.cpp
    engines/mads/nebular/mac_dialogs.h


diff --git a/engines/mads/nebular/mac_dialogs.cpp b/engines/mads/nebular/mac_dialogs.cpp
index e42d714a2db..5e00f7cfdea 100644
--- a/engines/mads/nebular/mac_dialogs.cpp
+++ b/engines/mads/nebular/mac_dialogs.cpp
@@ -284,13 +284,13 @@ void MacNebularDialog::drawCheckbox(const Item &item,
 		&_windowManager.getBuiltinPatterns(), 1, 0, 0,
 		Common::Point(1, 1), _windowManager._colorWhite, false);
 	const int boxTop = bounds.top + (bounds.height() - 12) / 2;
-	const Common::Rect box(bounds.left, boxTop, bounds.left + 12, boxTop + 12);
-	primitives.drawRect1(box, _windowManager._colorBlack, &plot);
+	const Common::Rect cbox(bounds.left, boxTop, bounds.left + 12, boxTop + 12);
+	primitives.drawRect1(cbox, _windowManager._colorBlack, &plot);
 	if (item.checked) {
-		primitives.drawLine(box.left + 2, box.top + 2,
-			box.right - 3, box.bottom - 3, _windowManager._colorBlack, &plot);
-		primitives.drawLine(box.left + 2, box.bottom - 3,
-			box.right - 3, box.top + 2, _windowManager._colorBlack, &plot);
+		primitives.drawLine(cbox.left + 2, cbox.top + 2,
+			cbox.right - 3, cbox.bottom - 3, _windowManager._colorBlack, &plot);
+		primitives.drawLine(cbox.left + 2, cbox.bottom - 3,
+			cbox.right - 3, cbox.top + 2, _windowManager._colorBlack, &plot);
 	}
 	const int textY = bounds.top +
 		(bounds.height() - _font->getFontHeight()) / 2;
@@ -708,14 +708,13 @@ bool MacNebularDialog::hasEditableFocus() const {
 	return item && item->enabled && item->type == kEditableText;
 }
 
-bool MacNebularDialog::isEditCommandEnabled(
-		MacDialogEditCommand command) const {
+bool MacNebularDialog::isEditCommandEnabled(MacDialogEditCommand commandId) const {
 	const Item *item = getItem(_focusItem);
 	if (!item || !item->enabled || item->type != kEditableText)
 		return false;
 
 	const bool hasSelection = item->selectionStart != item->selectionEnd;
-	switch (command) {
+	switch (commandId) {
 	case kMacDialogUndo:
 		return item->hasUndo;
 	case kMacDialogCut:
@@ -728,7 +727,7 @@ bool MacNebularDialog::isEditCommandEnabled(
 	return false;
 }
 
-bool MacNebularDialog::handleEditCommand(MacDialogEditCommand command) {
+bool MacNebularDialog::handleEditCommand(MacDialogEditCommand commandId) {
 	Item *item = getItem(_focusItem);
 	if (!item || !item->enabled || item->type != kEditableText)
 		return false;
@@ -739,7 +738,7 @@ bool MacNebularDialog::handleEditCommand(MacDialogEditCommand command) {
 	if (end > start)
 		selected = item->text.substr(start, end - start);
 
-	switch (command) {
+	switch (commandId) {
 	case kMacDialogUndo:
 		if (!item->hasUndo)
 			return false;
diff --git a/engines/mads/nebular/mac_dialogs.h b/engines/mads/nebular/mac_dialogs.h
index 128cf2aa33a..d419fb6896b 100644
--- a/engines/mads/nebular/mac_dialogs.h
+++ b/engines/mads/nebular/mac_dialogs.h
@@ -142,8 +142,8 @@ public:
 		int selection);
 	int getListSelection(int itemNumber) const;
 	bool hasEditableFocus() const;
-	bool isEditCommandEnabled(MacDialogEditCommand command) const;
-	bool handleEditCommand(MacDialogEditCommand command);
+	bool isEditCommandEnabled(MacDialogEditCommand commandId) const;
+	bool handleEditCommand(MacDialogEditCommand commandId);
 	int runModal(int defaultItem, int cancelItem);
 };
 




More information about the Scummvm-git-logs mailing list