[Scummvm-git-logs] scummvm master -> a86febb98668a6f324ecf8310bf7accd198d8ad7

dreammaster noreply at scummvm.org
Sat Apr 25 07:14:35 UTC 2026


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

Summary:
dbe6f23670 MADS: PHANTOM: Palette functions pass palette by reference
5e2ecd5e19 MADS: PHANTOM: Improve buffer functions to pass by reference
a86febb986 MADS: PHANTOM: Fix colors/background for Difficulty dialog


Commit: dbe6f236703b65d75e305dbcb208c8064ebbdcdc
    https://github.com/scummvm/scummvm/commit/dbe6f236703b65d75e305dbcb208c8064ebbdcdc
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-04-25T17:14:23+10:00

Commit Message:
MADS: PHANTOM: Palette functions pass palette by reference

Changed paths:
    engines/mads/madsv2/core/pal.cpp
    engines/mads/madsv2/core/pal.h


diff --git a/engines/mads/madsv2/core/pal.cpp b/engines/mads/madsv2/core/pal.cpp
index b4f24102500..f3690c5af63 100644
--- a/engines/mads/madsv2/core/pal.cpp
+++ b/engines/mads/madsv2/core/pal.cpp
@@ -543,7 +543,7 @@ int pal_get_colors() {
 	return(out);
 }
 
-void pal_interface(Palette fixpal) {
+void pal_interface(Palette &fixpal) {
 	int intensity, red, green, blue;
 	int base, newCol;
 	int color;
@@ -568,7 +568,7 @@ void pal_interface(Palette fixpal) {
 
 
 
-void pal_white(Palette fixpal) {
+void pal_white(Palette &fixpal) {
 	int count;
 	byte num[4] = { 0, 21, 42, 63 };
 
@@ -580,7 +580,7 @@ void pal_white(Palette fixpal) {
 }
 
 
-void pal_grey(Palette fixpal, int base_color, int num_colors,
+void pal_grey(Palette &fixpal, int base_color, int num_colors,
 	int low_grey, int high_grey) {
 	int count;
 	int dif;
diff --git a/engines/mads/madsv2/core/pal.h b/engines/mads/madsv2/core/pal.h
index ce060b8ab54..3d020579d84 100644
--- a/engines/mads/madsv2/core/pal.h
+++ b/engines/mads/madsv2/core/pal.h
@@ -156,9 +156,9 @@ extern void pal_init_shadow(ShadowListPtr shadow, ColorListPtr new_list);
 extern void pal_activate_shadow(ShadowListPtr shadow);
 extern int pal_get_flags(void);
 extern int pal_get_colors(void);
-extern void pal_interface(Palette fixpal);
-extern void pal_white(Palette fixpal);
-extern void pal_grey(Palette fixpal, int base_color, int num_colors,
+extern void pal_interface(Palette &fixpal);
+extern void pal_white(Palette &fixpal);
+extern void pal_grey(Palette &fixpal, int base_color, int num_colors,
 	int low_grey, int high_grey);
 extern int pal_get_color(RGBcolor color, int color_handle,
 	int override_reserved, int *color_number);


Commit: 5e2ecd5e19d3f6887a8b23de6b59195e45f23820
    https://github.com/scummvm/scummvm/commit/5e2ecd5e19d3f6887a8b23de6b59195e45f23820
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-04-25T17:14:23+10:00

Commit Message:
MADS: PHANTOM: Improve buffer functions to pass by reference

Changed paths:
    engines/mads/madsv2/core/buffer.cpp
    engines/mads/madsv2/core/buffer.h


diff --git a/engines/mads/madsv2/core/buffer.cpp b/engines/mads/madsv2/core/buffer.cpp
index 6c69f0aee2d..1794fd4ac6f 100644
--- a/engines/mads/madsv2/core/buffer.cpp
+++ b/engines/mads/madsv2/core/buffer.cpp
@@ -81,7 +81,7 @@ bool buffer_free(Buffer *buf) {
 	return flag;
 }
 
-bool buffer_fill(Buffer target, byte value) {
+bool buffer_fill(Buffer &target, byte value) {
 	return buffer_rect_fill(target, 0, 0, target.x, target.y, value);
 }
 
@@ -107,7 +107,7 @@ bool buffer_rect_copy(Buffer from, Buffer unto,
 	return result;
 }
 
-bool buffer_rect_fill(Buffer target, int ul_x, int  ul_y, int  size_x, int  size_y, byte value) {
+bool buffer_rect_fill(Buffer &target, int ul_x, int  ul_y, int  size_x, int  size_y, byte value) {
 	bool result;
 
 	if (buffer_conform(&target, &ul_x, &ul_y, &size_x, &size_y))
@@ -128,7 +128,7 @@ bool buffer_rect_fill(Buffer target, int ul_x, int  ul_y, int  size_x, int  size
 	return result;
 }
 
-bool buffer_rect_copy_2(Buffer from, Buffer unto,
+bool buffer_rect_copy_2(const Buffer &from, Buffer &unto,
 		int from_x, int from_y, int unto_x, int unto_y, int size_x, int size_y) {
 	bool result;
 
@@ -136,7 +136,7 @@ bool buffer_rect_copy_2(Buffer from, Buffer unto,
 
 	if (result && size_x > 0 && size_y > 0)
 	{
-		byte *from_ptr = buffer_pointer(&from, from_x, from_y);
+		const byte *from_ptr = buffer_pointer(&from, from_x, from_y);
 		byte *unto_ptr = buffer_pointer(&unto, unto_x, unto_y);
 		int   from_wrap = from.x - size_x;
 		int   unto_wrap = unto.x - size_x;
@@ -152,22 +152,22 @@ bool buffer_rect_copy_2(Buffer from, Buffer unto,
 	return result;
 }
 
-void buffer_put_pixel(Buffer buf, word x, word y, byte c) {
+void buffer_put_pixel(Buffer &buf, word x, word y, byte c) {
 	buf.data[y * buf.x + x] = c;
 }
 
-byte buffer_get_pixel(Buffer buf, word x, word y) {
+byte buffer_get_pixel(const Buffer &buf, word x, word y) {
 	return buf.data[y * buf.x + x];
 }
 
-void buffer_hline(Buffer buf, word x1, word x2, word y, byte color) {
+void buffer_hline(Buffer &buf, word x1, word x2, word y, byte color) {
 	byte *ptr = buf.data + (y * buf.x) + x1;
 	int   count = x2 - x1 + 1;
 
 	memset(ptr, color, count);
 }
 
-void buffer_vline(Buffer buf, word x, word y1, word y2, byte color) {
+void buffer_vline(Buffer &buf, word x, word y1, word y2, byte color) {
 	byte *ptr = buf.data + (y1 * buf.x) + x;
 	int   count = y2 - y1 + 1;
 
@@ -175,7 +175,7 @@ void buffer_vline(Buffer buf, word x, word y1, word y2, byte color) {
 		*ptr = color;
 }
 
-void buffer_draw_box(Buffer buf, word x1, word y1, word x2, word y2, byte color) {
+void buffer_draw_box(Buffer &buf, word x1, word y1, word x2, word y2, byte color) {
 	int tmp;
 
 	if (x1 > x2) {
@@ -189,7 +189,7 @@ void buffer_draw_box(Buffer buf, word x1, word y1, word x2, word y2, byte color)
 	buffer_vline(buf, x1, y1, y2, color); buffer_vline(buf, x2, y1, y2, color);
 }
 
-void buffer_hline_xor(Buffer buf, int x1, int x2, int y) {
+void buffer_hline_xor(Buffer &buf, int x1, int x2, int y) {
 	if (x1 > x2)
 	{
 		int tmp = x1;
@@ -204,7 +204,7 @@ void buffer_hline_xor(Buffer buf, int x1, int x2, int y) {
 		ptr[i] ^= 0xFF;
 }
 
-void buffer_vline_xor(Buffer buf, int x, int y1, int y2) {
+void buffer_vline_xor(Buffer &buf, int x, int y1, int y2) {
 	if (y1 > y2)
 	{
 		int tmp = y1;
@@ -219,12 +219,12 @@ void buffer_vline_xor(Buffer buf, int x, int y1, int y2) {
 		*ptr ^= 0xFF;
 }
 
-void buffer_draw_crosshair(Buffer buf, int x, int y) {
+void buffer_draw_crosshair(Buffer &buf, int x, int y) {
 	buffer_hline_xor(buf, 0, buf.x - 1, y);
 	buffer_vline_xor(buf, x, 0, buf.y - 1);
 }
 
-void buffer_draw_box_xor(Buffer buf, int x1, int y1, int x2, int y2) {
+void buffer_draw_box_xor(Buffer &buf, int x1, int y1, int x2, int y2) {
 	int tmp;
 
 	if (x1 > x2) {
@@ -240,7 +240,7 @@ void buffer_draw_box_xor(Buffer buf, int x1, int y1, int x2, int y2) {
 	buffer_vline_xor(buf, x2, y1 + 1, y2 - 1);
 }
 
-int buffer_get_delta_bounds(Buffer buf1, Buffer buf2, int newcol,
+int buffer_get_delta_bounds(Buffer &buf1, Buffer buf2, int newcol,
 	word *xl, word *xh, word *yl, word *yh) {
 	if (buf1.x != buf2.x || buf1.y != buf2.y)
 		return -1;
@@ -276,15 +276,16 @@ int buffer_get_delta_bounds(Buffer buf1, Buffer buf2, int newcol,
 byte *buffer_pointer(Buffer *buf, int x, int y) {
 	return buf->data + y * buf->x + x;
 }
+const byte *buffer_pointer(const Buffer *buf, int x, int y) {
+	return buf->data + y * buf->x + x;
+}
 
 bool buffer_conform(Buffer *buffer, int *x, int *y, int *xs, int *ys) {
-	if (*x < 0)
-	{
+	if (*x < 0) {
 		*xs += *x;
 		*x = 0;
 	}
-	if (*y < 0)
-	{
+	if (*y < 0) {
 		*ys += *y;
 		*y = 0;
 	}
diff --git a/engines/mads/madsv2/core/buffer.h b/engines/mads/madsv2/core/buffer.h
index 05b6a302282..5ffce131b79 100644
--- a/engines/mads/madsv2/core/buffer.h
+++ b/engines/mads/madsv2/core/buffer.h
@@ -69,7 +69,7 @@ extern bool buffer_free(Buffer *buf);
  * Fills an entire buffer with a single byte value.
  * @return	Returns true if successful.
  */
-extern bool buffer_fill(Buffer target, byte value);
+extern bool buffer_fill(Buffer &target, byte value);
 
 /**
  * Copies a "rectangular" buffer area from "from" to "unto".  Size
@@ -92,7 +92,7 @@ extern bool buffer_rect_copy(Buffer from, Buffer unto,
  * but "null" copies (x or y size 0) are handled correctly.
  * @return	Returns TRUE if successful; false if buffer invalid.
  */
-extern bool buffer_rect_fill(Buffer target,
+extern bool buffer_rect_fill(Buffer &target,
 	int ul_x, int ul_y, int size_x, int size_y, byte value);
 
 /**
@@ -105,7 +105,7 @@ extern bool buffer_rect_fill(Buffer target,
  *
  * @return	Returns TRUE if successful.
  */
-extern bool buffer_rect_copy_2(Buffer from, Buffer unto,
+extern bool buffer_rect_copy_2(const Buffer &from, Buffer &unto,
 	int    from_x, int    from_y,
 	int    unto_x, int    unto_y,
 	int    size_x, int    size_y);
@@ -113,49 +113,49 @@ extern bool buffer_rect_copy_2(Buffer from, Buffer unto,
 /**
  * Given X and Y, sets pixel to color C
  */
-void buffer_put_pixel(Buffer buf, word x, word y, byte c);
+void buffer_put_pixel(Buffer &buf, word x, word y, byte c);
 
 /**
  * Given X and Y, gets the pixel at that position.
  */
-byte buffer_get_pixel(Buffer buf, word x, word y);
+byte buffer_get_pixel(const Buffer &buf, word x, word y);
 
 /**
  * Given starting and ending points on the X axis, and the constant
  * Y value, draws a line in the given color on the live MCGA screen.
  */
-void buffer_hline(Buffer buf, word x1, word x2, word y, byte color);
+void buffer_hline(Buffer &buf, word x1, word x2, word y, byte color);
 
 /**
  * Given starting and ending points on the Y axis, and the constant
  * X value, draws a line in the given color on the live MCGA screen.
  */
-void buffer_vline(Buffer buf, word x, word y1, word y2, byte color);
+void buffer_vline(Buffer &buf, word x, word y1, word y2, byte color);
 
 /**
  * Draws outside edge of retangle given home and size along both axis.
  */
-void buffer_draw_box(Buffer buf, word x1, word y1, word x2, word y2, byte color);
+void buffer_draw_box(Buffer &buf, word x1, word y1, word x2, word y2, byte color);
 
 /**
  * Draws a horizontal line by xoring/inverting the existing pixels
  */
-void buffer_hline_xor(Buffer buf, int x1, int x2, int y);
+void buffer_hline_xor(Buffer &buf, int x1, int x2, int y);
 
 /**
  * Draws a vertical line by xoring/inverting the existing pixels
  */
-void buffer_vline_xor(Buffer buf, int x, int y1, int y2);
+void buffer_vline_xor(Buffer &buf, int x, int y1, int y2);
 
 /**
  * Draws a cross-hairs at the specified x, y
  */
-void buffer_draw_crosshair(Buffer buf, int x, int y);
+void buffer_draw_crosshair(Buffer &buf, int x, int y);
 
 /**
  * Draws a box using pixel xor inversion
  */
-void buffer_draw_box_xor(Buffer buf, int x1, int y1, int x2, int y2);
+void buffer_draw_box_xor(Buffer &buf, int x1, int y1, int x2, int y2);
 
 /**
  * Scans the two buffers.  Locations that are not the same on both buffers
@@ -163,7 +163,7 @@ void buffer_draw_box_xor(Buffer buf, int x1, int y1, int x2, int y2);
  * in the words pointed to by *XL,*XH,*YL,*YH.
  * @return	Returns -1 if an error occurs.
  */
-extern bool buffer_get_delta_bounds(Buffer buf1, Buffer buf2,
+extern bool buffer_get_delta_bounds(Buffer &buf1, Buffer buf2,
 	byte newcol, word *xl, word *xh, word *yl, word *yh);
 
 /**
@@ -174,6 +174,7 @@ extern bool buffer_get_delta_bounds(Buffer buf1, Buffer buf2,
  * @return		Pointer
  */
 extern byte *buffer_pointer(Buffer *buf, int x, int y);
+extern const byte *buffer_pointer(const Buffer *buf, int x, int y);
 
 extern bool buffer_conform(Buffer *buffer, int *x, int *y,
 	int *xs, int *ys);


Commit: a86febb98668a6f324ecf8310bf7accd198d8ad7
    https://github.com/scummvm/scummvm/commit/a86febb98668a6f324ecf8310bf7accd198d8ad7
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2026-04-25T17:14:23+10:00

Commit Message:
MADS: PHANTOM: Fix colors/background for Difficulty dialog

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 013a698713f..e9bb7537d08 100644
--- a/engines/mads/madsv2/core/kernel.cpp
+++ b/engines/mads/madsv2/core/kernel.cpp
@@ -513,6 +513,9 @@ int kernel_game_startup(int game_video_mode, int load_flag,
 		}
 	}
 
+	buffer_fill(scr_live, 0);
+	mcga_setpal(&master_palette);
+
 	error_flag = false;
 
 done:




More information about the Scummvm-git-logs mailing list