[Scummvm-git-logs] scummvm master -> 525b0acbd8744412da484a941f7b02f4f80a9f0f

dreammaster noreply at scummvm.org
Wed Apr 22 06:18:15 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:
525b0acbd8 MADS: PHANTOM: Fix crash with Madame Giry opening box 5


Commit: 525b0acbd8744412da484a941f7b02f4f80a9f0f
    https://github.com/scummvm/scummvm/commit/525b0acbd8744412da484a941f7b02f4f80a9f0f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-04-22T16:16:22+10:00

Commit Message:
MADS: PHANTOM: Fix crash with Madame Giry opening box 5

This is likely an original engine bug. The high bit of the
sprite_id field is used to denote mirroring, but in this
case, without stripping it off, it resulted in an invalid
index when the sprite_id was used as an array index.

Changed paths:
    engines/mads/madsv2/core/kernel.cpp


diff --git a/engines/mads/madsv2/core/kernel.cpp b/engines/mads/madsv2/core/kernel.cpp
index 79b573915b5..35e47ddd030 100644
--- a/engines/mads/madsv2/core/kernel.cpp
+++ b/engines/mads/madsv2/core/kernel.cpp
@@ -1639,9 +1639,11 @@ static void kernel_hot_check(int hot, int id, int seg_id) {
 		if (seg_id == (int)kernel_dynamic_hot[hot].auto_segment[count]) {
 
 			scale = image_list[id].scale;
+			int spriteIndex = (image_list[id].sprite_id & SPRITE_MASK) - 1;
+
 			if (scale == IMAGE_UNSCALED) {
-				xs = series_list[image_list[id].series_id]->index[image_list[id].sprite_id - 1].xs;
-				ys = series_list[image_list[id].series_id]->index[image_list[id].sprite_id - 1].ys;
+				xs = series_list[image_list[id].series_id]->index[spriteIndex].xs;
+				ys = series_list[image_list[id].series_id]->index[spriteIndex].ys;
 				x = image_list[id].x;
 				y = image_list[id].y;
 				x1 = x;
@@ -1649,8 +1651,8 @@ static void kernel_hot_check(int hot, int id, int seg_id) {
 				x2 = x + xs - 1;
 				y2 = y + ys - 1;
 			} else {
-				xs = (series_list[image_list[id].series_id]->index[image_list[id].sprite_id - 1].xs * image_list[id].scale) / 200;
-				ys = (series_list[image_list[id].series_id]->index[image_list[id].sprite_id - 1].ys * image_list[id].scale) / 100;
+				xs = (series_list[image_list[id].series_id]->index[spriteIndex].xs * image_list[id].scale) / 200;
+				ys = (series_list[image_list[id].series_id]->index[spriteIndex].ys * image_list[id].scale) / 100;
 				x = image_list[id].x;
 				y = image_list[id].y;
 				x1 = x - xs;




More information about the Scummvm-git-logs mailing list