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

lolbot-iichan lolbot_iichan at mail.ru
Sat Jul 3 21:28:20 UTC 2021


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

Summary:
f7d54f2341 WINTERMUTE: Apply colorkey according to subengine version


Commit: f7d54f2341ad4fbe80403de735c232dbfdb56565
    https://github.com/scummvm/scummvm/commit/f7d54f2341ad4fbe80403de735c232dbfdb56565
Author: lb_ii (lolbot_iichan at mail.ru)
Date: 2021-07-04T00:28:17+03:00

Commit Message:
WINTERMUTE: Apply colorkey according to subengine version

Changed paths:
    engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
    engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp


diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
index 7628037e1c..22b0424de7 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
@@ -22,6 +22,7 @@
 
 #include "common/algorithm.h"
 #include "graphics/transform_tools.h"
+#include "engines/wintermute/base/base_engine.h"
 #include "engines/wintermute/base/gfx/base_image.h"
 
 #if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS) || defined(USE_GLES2)
@@ -174,11 +175,19 @@ bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK,
 
 	_imageData = img.getSurface()->convertTo(OpenGL::TextureGL::getRGBAPixelFormat(), img.getPalette());
 
-	if (_filename.hasSuffix(".bmp") && img.getSurface()->format.bytesPerPixel == 4) {
-		// 32 bpp BMPs have nothing useful in their alpha-channel -> color-key
+	if (BaseEngine::instance().getTargetExecutable() < WME_LITE) {
+		// WME 1.x always use colorkey, even for images with transparency
+		needsColorKey = true;
+		replaceAlpha = false;
+	} else if (BaseEngine::instance().isFoxTail()) {
+		// FoxTail does not use colorkey
+		needsColorKey = false;
+	} else if (_filename.hasSuffix(".bmp")) {
+		// generic WME Lite ignores alpha channel for BMPs
 		needsColorKey = true;
 		replaceAlpha = false;
 	} else if (img.getSurface()->format.aBits() == 0) {
+		// generic WME Lite does not use colorkey for non-BMPs with transparency
 		needsColorKey = true;
 	}
 
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index 620c282ba3..cdce6dd2cc 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -160,22 +160,27 @@ bool BaseSurfaceOSystem::finishLoad() {
 			error("Missing palette while loading 8bit image %s", _filename.c_str());
 		}
 		_surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette());
-		needsColorKey = true;
+	} else if (image->getSurface()->format != g_system->getScreenFormat()) {
+		_surface = image->getSurface()->convertTo(g_system->getScreenFormat());
 	} else {
-		if (image->getSurface()->format != g_system->getScreenFormat()) {
-			_surface = image->getSurface()->convertTo(g_system->getScreenFormat());
-		} else {
-			_surface = new Graphics::Surface();
-			_surface->copyFrom(*image->getSurface());
-		}
+		_surface = new Graphics::Surface();
+		_surface->copyFrom(*image->getSurface());
+	}
 
-		if (_filename.hasSuffix(".bmp") && image->getSurface()->format.bytesPerPixel == 4) {
-			// 32 bpp BMPs have nothing useful in their alpha-channel -> color-key
-			needsColorKey = true;
-			replaceAlpha = false;
-		} else if (image->getSurface()->format.aBits() == 0) {
-			needsColorKey = true;
-		}
+	if (BaseEngine::instance().getTargetExecutable() < WME_LITE) {
+		// WME 1.x always use colorkey, even for images with transparency
+		needsColorKey = true;
+		replaceAlpha = false;
+	} else if (BaseEngine::instance().isFoxTail()) {
+		// FoxTail does not use colorkey
+		needsColorKey = false;
+	} else if (_filename.hasSuffix(".bmp")) {
+		// generic WME Lite ignores alpha channel for BMPs
+		needsColorKey = true;
+		replaceAlpha = false;
+	} else if (image->getSurface()->format.aBits() == 0) {
+		// generic WME Lite does not use colorkey for non-BMPs with transparency
+		needsColorKey = true;
 	}
 
 	if (needsColorKey) {




More information about the Scummvm-git-logs mailing list