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

mduggan noreply at scummvm.org
Sun Nov 19 22:54:01 UTC 2023


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

Summary:
eba5780aab ULTIMA: ULTIMA6: Fix assert on loading roof bitmap
eb91759277 ULTIMA: ULTIMA6: Fix roof drawing


Commit: eba5780aab5aaa7c6c6b3cfec208ed3a89efea89
    https://github.com/scummvm/scummvm/commit/eba5780aab5aaa7c6c6b3cfec208ed3a89efea89
Author: PushmePullyu (127053144+PushmePullyu at users.noreply.github.com)
Date: 2023-11-20T09:53:57+11:00

Commit Message:
ULTIMA: ULTIMA6: Fix assert on loading roof bitmap

Do not ignore palette when loading bitmaps via SDL_LoadBMP.

Prevents the following assert on game start when roof drawing
is enabled:

"graphics/managed_surface.cpp:298:
void Graphics::ManagedSurface::blitFromInner(const Graphics::Surface&,
 const Common::Rect&, const Common::Rect&, const byte*):
Assertion `!destFormat.isCLUT8() && srcPalette' failed."

The bug was introduced in c4970c95dc48fdf38891cec3740ccf98dfd090f9
"Fix crash in GUI on surface blit"

Fixes #14687

Changed paths:
    engines/ultima/nuvie/misc/sdl_compat.cpp


diff --git a/engines/ultima/nuvie/misc/sdl_compat.cpp b/engines/ultima/nuvie/misc/sdl_compat.cpp
index 0d894e94e75..a26fb164369 100644
--- a/engines/ultima/nuvie/misc/sdl_compat.cpp
+++ b/engines/ultima/nuvie/misc/sdl_compat.cpp
@@ -98,7 +98,7 @@ Graphics::ManagedSurface *SDL_LoadBMP(const char *filename) {
 	Graphics::ManagedSurface *const screenSurface = screen->get_sdl_surface();
 	assert (screenSurface);
 	Graphics::ManagedSurface *dest = new Graphics::ManagedSurface(src->w, src->h, screenSurface->format);
-	dest->blitFrom(*src);
+	dest->blitFrom(*src, decoder.getPalette());
 
 	return dest;
 }


Commit: eb91759277768953fed0b272f7cc7878e892abb4
    https://github.com/scummvm/scummvm/commit/eb91759277768953fed0b272f7cc7878e892abb4
Author: PushmePullyu (127053144+PushmePullyu at users.noreply.github.com)
Date: 2023-11-20T09:53:57+11:00

Commit Message:
ULTIMA: ULTIMA6: Fix roof drawing

SDL_LoadBMP() was changed to convert to screen pixel format in
commit c4970c95dc48fdf38891cec3740ccf98dfd090f9
"Fix crash in GUI on surface blit".

The change causes roofs to be drawn garbled when game style is set to
"new style", as the blitting code expects an unconverted bitmap.

Adjust roof drawing to use ManagedSurface::blitFrom instead.

Changed paths:
    engines/ultima/nuvie/gui/widgets/map_window.cpp
    engines/ultima/nuvie/gui/widgets/map_window.h


diff --git a/engines/ultima/nuvie/gui/widgets/map_window.cpp b/engines/ultima/nuvie/gui/widgets/map_window.cpp
index 1746d108195..03dd65bc0d7 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.cpp
+++ b/engines/ultima/nuvie/gui/widgets/map_window.cpp
@@ -306,6 +306,10 @@ bool MapWindow::set_windowSize(uint16 width, uint16 height) {
 	}
 	anim_manager->set_area(clip_rect);
 
+	Screen *const gameScreen = Game::get_game()->get_screen();
+	assert(gameScreen);
+	_mapWinSubSurf.create(*gameScreen->get_sdl_surface(), clip_rect);
+
 	reset_mousecenter();
 
 	updateBlacking();
@@ -1303,9 +1307,9 @@ void MapWindow::drawRoofs() {
 						}
 						SDL_BlitSurface(roof_tiles, &src, surface, &dst);
 					} else {
-						byte *ptr = (byte *)roof_tiles->getPixels();
-						ptr += src.left + src.top * 80;
-						screen->blit(dst.left, dst.top, ptr, 8, 16, 16, 80, true, &clip_rect);
+						src.setWidth(16);
+						src.setHeight(16);
+						_mapWinSubSurf.blitFrom(*roof_tiles, src, Common::Point(dst.left, dst.top));
 					}
 				}
 			}
@@ -2652,7 +2656,7 @@ void MapWindow::set_roof_mode(bool roofs) {
 void MapWindow::loadRoofTiles() {
 	Std::string imagefile = map->getRoofTilesetFilename();
 	roof_tiles = SDL_LoadBMP(imagefile.c_str());
-	if (roof_tiles && game->is_orig_style()) {
+	if (roof_tiles) {
 		SDL_SetColorKey(roof_tiles, SDL_TRUE, SDL_MapRGB(roof_tiles->format, 0, 0x70, 0xfc));
 	}
 }
diff --git a/engines/ultima/nuvie/gui/widgets/map_window.h b/engines/ultima/nuvie/gui/widgets/map_window.h
index 6404bdbc4e4..24b2ef7b0a1 100644
--- a/engines/ultima/nuvie/gui/widgets/map_window.h
+++ b/engines/ultima/nuvie/gui/widgets/map_window.h
@@ -119,6 +119,7 @@ class MapWindow: public GUI_Widget {
 	sint32 vel_x, vel_y; // velocity of automatic map movement (pixels per second)
 
 	Common::Rect clip_rect;
+	Graphics::ManagedSurface _mapWinSubSurf; // sub surface of the screen clipped to MapWindow's clip_rect
 
 	Obj *selected_obj;
 	Actor *look_actor;




More information about the Scummvm-git-logs mailing list