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

sev- sev at scummvm.org
Wed May 12 21:19:41 UTC 2021


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

Summary:
7d61637afd SLUDGE: Renamed debug channels and disabled the pre-enabled ones
4df3f33399 GRAPHICS: Fix mess with color components in TransparentSurface
1d72d5be35 NGI: Fix alpha handling to sync with TransparentSurface
b93aa9b05d SLUDGE: Fix transparency handling


Commit: 7d61637afdebfe83d7f098dd0c2eaf3b574a4c7d
    https://github.com/scummvm/scummvm/commit/7d61637afdebfe83d7f098dd0c2eaf3b574a4c7d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-12T23:19:19+02:00

Commit Message:
SLUDGE: Renamed debug channels and disabled the pre-enabled ones

Changed paths:
    engines/sludge/sludge.cpp


diff --git a/engines/sludge/sludge.cpp b/engines/sludge/sludge.cpp
index 9393c44a2e..b940afb074 100644
--- a/engines/sludge/sludge.cpp
+++ b/engines/sludge/sludge.cpp
@@ -56,16 +56,16 @@ SludgeEngine::SludgeEngine(OSystem *syst, const SludgeGameDescription *gameDesc)
 	_rnd = new Common::RandomSource("sludge");
 
 	// Add debug channels
-	DebugMan.addDebugChannel(kSludgeDebugFatal, "Script", "Script debug level");
-	DebugMan.addDebugChannel(kSludgeDebugDataLoad, "Data Load", "Data loading debug level");
-	DebugMan.addDebugChannel(kSludgeDebugStackMachine, "Stack Machine", "Stack Machine debug level");
-	DebugMan.addDebugChannel(kSludgeDebugBuiltin, "Built-in", "Built-in debug level");
-	DebugMan.addDebugChannel(kSludgeDebugGraphics, "Graphics", "Graphics debug level");
-	DebugMan.addDebugChannel(kSludgeDebugZBuffer, "ZBuffer", "ZBuffer debug level");
-	DebugMan.addDebugChannel(kSludgeDebugSound, "Sound", "Sound debug level");
-
-	DebugMan.enableDebugChannel("Data Load");
-	DebugMan.enableDebugChannel("Built-in");
+	DebugMan.addDebugChannel(kSludgeDebugFatal, "script", "Script debug level");
+	DebugMan.addDebugChannel(kSludgeDebugDataLoad, "loading", "Data loading debug level");
+	DebugMan.addDebugChannel(kSludgeDebugStackMachine, "stack", "Stack Machine debug level");
+	DebugMan.addDebugChannel(kSludgeDebugBuiltin, "builtin", "Built-in debug level");
+	DebugMan.addDebugChannel(kSludgeDebugGraphics, "graphics", "Graphics debug level");
+	DebugMan.addDebugChannel(kSludgeDebugZBuffer, "zBuffer", "ZBuffer debug level");
+	DebugMan.addDebugChannel(kSludgeDebugSound, "sound", "Sound debug level");
+
+	//DebugMan.enableDebugChannel("loading");
+	//DebugMan.enableDebugChannel("builtin");
 
 	_dumpScripts = ConfMan.getBool("dump_scripts");
 


Commit: 4df3f333990c4cd0f0d1fda9ad1eb03e054fb2e9
    https://github.com/scummvm/scummvm/commit/4df3f333990c4cd0f0d1fda9ad1eb03e054fb2e9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-12T23:19:19+02:00

Commit Message:
GRAPHICS: Fix mess with color components in TransparentSurface

We were having it inconsistent for years and since the feature is underused,
nobody noticed. Also endianness doesn't make sense for the shifts,
only for the color indexes

Changed paths:
    graphics/transparent_surface.cpp
    graphics/transparent_surface.h


diff --git a/graphics/transparent_surface.cpp b/graphics/transparent_surface.cpp
index a1b03bd340..11245d4531 100644
--- a/graphics/transparent_surface.cpp
+++ b/graphics/transparent_surface.cpp
@@ -35,10 +35,10 @@
 
 namespace Graphics {
 
-static const int kBModShift = 0;//img->format.bShift;
-static const int kGModShift = 8;//img->format.gShift;
-static const int kRModShift = 16;//img->format.rShift;
-static const int kAModShift = 24;//img->format.aShift;
+static const int kBModShift = 8;//img->format.bShift;
+static const int kGModShift = 16;//img->format.gShift;
+static const int kRModShift = 24;//img->format.rShift;
+static const int kAModShift = 0;//img->format.aShift;
 
 #ifdef SCUMM_LITTLE_ENDIAN
 static const int kAIndex = 0;
diff --git a/graphics/transparent_surface.h b/graphics/transparent_surface.h
index c23a33368f..1dc743b700 100644
--- a/graphics/transparent_surface.h
+++ b/graphics/transparent_surface.h
@@ -35,13 +35,8 @@
  *
  */
 
-#ifdef SCUMM_LITTLE_ENDIAN
-#define TS_RGB(R,G,B)       (uint32)((0xff << 24) | ((R) << 16) | ((G) << 8) | (B))
+#define TS_RGB(R,G,B)       (uint32)(((R) << 24) | ((G) << 16) | ((B) << 8) | 0xff)
 #define TS_ARGB(A,R,G,B)    (uint32)(((R) << 24) | ((G) << 16) | ((B) << 8) | (A))
-#else
-#define TS_RGB(R,G,B)       (uint32)(((R) << 24) | ((G) << 16) | (B << 8) | 0xff)
-#define TS_ARGB(A,R,G,B)    (uint32)(((R) << 24) | ((G) << 16) | ((B) << 8) | (A))
-#endif
 
 namespace Graphics {
 


Commit: 1d72d5be359b17ae340244fa01790729dcc2a74b
    https://github.com/scummvm/scummvm/commit/1d72d5be359b17ae340244fa01790729dcc2a74b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-12T23:19:19+02:00

Commit Message:
NGI: Fix alpha handling to sync with TransparentSurface

Changed paths:
    engines/ngi/gfx.cpp


diff --git a/engines/ngi/gfx.cpp b/engines/ngi/gfx.cpp
index 93f96c9b03..21d05170ea 100644
--- a/engines/ngi/gfx.cpp
+++ b/engines/ngi/gfx.cpp
@@ -778,7 +778,7 @@ void Bitmap::putDib(int x, int y, const Palette &palette, byte alpha) {
 	if (y1 < 0)
 		y1 = 0;
 
-	int alphac = TS_ARGB(0xff, alpha, 0xff, 0xff);
+	int alphac = TS_ARGB(alpha, 0xff, 0xff, 0xff);
 
 	_surface->blit(g_nmi->_backgroundSurface, x1, y1, _flipping, &sub, alphac);
 	g_nmi->_system->copyRectToScreen(g_nmi->_backgroundSurface.getBasePtr(x1, y1), g_nmi->_backgroundSurface.pitch, x1, y1, sub.width(), sub.height());


Commit: b93aa9b05daf19adaed49c4346e81214486f07a5
    https://github.com/scummvm/scummvm/commit/b93aa9b05daf19adaed49c4346e81214486f07a5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-12T23:19:19+02:00

Commit Message:
SLUDGE: Fix transparency handling

Changed paths:
    engines/sludge/backdrop.cpp
    engines/sludge/graphics.h
    engines/sludge/sprites.cpp
    engines/sludge/sprites.h


diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index be3a741211..ccaa015413 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -344,7 +344,7 @@ void GraphicsManager::drawHorizontalLine(uint x1, uint y, uint x2) {
 
 void GraphicsManager::darkScreen() {
 	Graphics::TransparentSurface tmp(_backdropSurface, false);
-	tmp.blit(_backdropSurface, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB(0, 255 >> 1, 0, 0));
+	tmp.blit(_backdropSurface, 0, 0, Graphics::FLIP_NONE, nullptr, TS_ARGB(255 >> 1, 0, 0, 0));
 
 	// reset zBuffer
 	if (_zBuffer->originalNum >= 0) {
@@ -479,7 +479,7 @@ bool GraphicsManager::mixHSI(int num, Common::SeekableReadStream *stream, int x,
 		return false;
 
 	Graphics::TransparentSurface tmp(mixSurface, false);
-	tmp.blit(_backdropSurface, x, y, Graphics::FLIP_NONE, nullptr, TS_ARGB(255, 255 >> 1, 255, 255));
+	tmp.blit(_backdropSurface, x, y, Graphics::FLIP_NONE, nullptr, TS_ARGB(255 >> 1, 255, 255, 255));
 	mixSurface.free();
 
 	return true;
diff --git a/engines/sludge/graphics.h b/engines/sludge/graphics.h
index a65d487deb..2a103b12ff 100644
--- a/engines/sludge/graphics.h
+++ b/engines/sludge/graphics.h
@@ -140,7 +140,7 @@ public:
 	void burnSpriteToBackDrop(int x1, int y1, Sprite &single, const SpritePalette &fontPal);
 
 	void resetSpriteLayers(ZBufferData *ptrZBuffer, int x, int y, bool upsidedown);
-	void addSpriteDepth(Graphics::Surface *ptr, int depth, int x, int y, Graphics::FLIP_FLAGS flip, int width = -1, int height = -1, bool disposeAfterUse = false);
+	void addSpriteDepth(Graphics::Surface *ptr, int depth, int x, int y, Graphics::FLIP_FLAGS flip, int width = -1, int height = -1, bool disposeAfterUse = false, byte trans = 255);
 	void displaySpriteLayers();
 	void killSpriteLayers();
 
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index c2e158aaa1..0781286b3b 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -387,12 +387,12 @@ Graphics::Surface *GraphicsManager::applyLightmapToSprite(Graphics::Surface *&bl
 		fb = curLight[2]*thisPerson->b * thisPerson->colourmix / 65025 / 255.0F;
 	}
 
-	uint32 primaryColor = TS_ARGB((uint8)(255 - thisPerson->transparency),
+	uint32 primaryColor = TS_ARGB(255,
 			(uint8)(fr + curLight[0] * (255 - thisPerson->colourmix) / 255.f),
 			(uint8)(fg + curLight[1] * (255 - thisPerson->colourmix) / 255.f),
 			(uint8)(fb + curLight[2] * (255 - thisPerson->colourmix) / 255.f));
 
-	uint32 secondaryColor = TS_ARGB(0, (uint8)(fr * 255), (uint8)(fg * 255), (uint8)(fb * 255));
+	uint32 secondaryColor = TS_ARGB(0xff, (uint8)(fr * 255), (uint8)(fg * 255), (uint8)(fb * 255));
 
 	// apply primary color
 	if (primaryColor != (uint32)TS_ARGB(255, 255, 255, 255)) {
@@ -455,7 +455,7 @@ bool GraphicsManager::scaleSprite(Sprite &single, const SpritePalette &fontPal,
 	// Use Transparent surface to scale and blit
 	if (!_zBuffer->numPanels) {
 		Graphics::TransparentSurface tmp(*blitted, false);
-		tmp.blit(_renderSurface, x1, y1, (mirror ? Graphics::FLIP_H : Graphics::FLIP_NONE), nullptr, TS_ARGB((uint)255, (uint)255, (uint)255, (uint)255), diffX, diffY);
+		tmp.blit(_renderSurface, x1, y1, (mirror ? Graphics::FLIP_H : Graphics::FLIP_NONE), nullptr, TS_ARGB(255 - thisPerson->transparency, 255, 255, 255), diffX, diffY);
 		if (ptr) {
 			ptr->free();
 			delete ptr;
@@ -463,7 +463,7 @@ bool GraphicsManager::scaleSprite(Sprite &single, const SpritePalette &fontPal,
 		}
 	} else {
 		int d = useZB ? y + _cameraY : (y + _cameraY > _sceneHeight * 0.6 ? _sceneHeight + 1 : 0);
-		addSpriteDepth(blitted, d, x1, y1, (mirror ? Graphics::FLIP_H : Graphics::FLIP_NONE), diffX, diffY, ptr);
+		addSpriteDepth(blitted, d, x1, y1, (mirror ? Graphics::FLIP_H : Graphics::FLIP_NONE), diffX, diffY, ptr, 255 - thisPerson->transparency);
 	}
 
 	// Are we pointing at the sprite?
@@ -496,7 +496,7 @@ void GraphicsManager::resetSpriteLayers(ZBufferData *pz, int x, int y, bool upsi
 	}
 }
 
-void GraphicsManager::addSpriteDepth(Graphics::Surface *ptr, int depth, int x, int y, Graphics::FLIP_FLAGS flip, int width, int height, bool freeAfterUse) {
+void GraphicsManager::addSpriteDepth(Graphics::Surface *ptr, int depth, int x, int y, Graphics::FLIP_FLAGS flip, int width, int height, bool freeAfterUse, byte trans) {
 	int i;
 	for (i = 1; i < _zBuffer->numPanels; ++i) {
 		if (_zBuffer->panel[i] >= depth) {
@@ -504,9 +504,9 @@ void GraphicsManager::addSpriteDepth(Graphics::Surface *ptr, int depth, int x, i
 		}
 	}
 	--i;
-	debugC(3, kSludgeDebugZBuffer, "Add sprite of Y-value : %i in layer %i", depth, i);
+	debugC(3, kSludgeDebugZBuffer, "Add sprite of Y-value : %i in layer %i trans: %02x", depth, i, trans);
 
-	SpriteDisplay *node = new SpriteDisplay(x, y, flip, ptr, width, height, freeAfterUse);
+	SpriteDisplay *node = new SpriteDisplay(x, y, flip, ptr, width, height, freeAfterUse, trans);
 	_spriteLayers->layer[i].push_back(node);
 }
 
@@ -516,7 +516,7 @@ void GraphicsManager::displaySpriteLayers() {
 		SpriteLayer::iterator it;
 		for (it = _spriteLayers->layer[i].begin(); it != _spriteLayers->layer[i].end(); ++it) {
 			Graphics::TransparentSurface tmp(*(*it)->surface, false);
-			tmp.blit(_renderSurface, (*it)->x, (*it)->y, (*it)->flip, nullptr, TS_ARGB((uint)255, (uint)255, (uint)255, (uint)255), (*it)->width, (*it)->height);
+			tmp.blit(_renderSurface, (*it)->x, (*it)->y, (*it)->flip, nullptr, TS_ARGB((*it)->transparency, 255, 255, 255), (*it)->width, (*it)->height);
 		}
 	}
 	killSpriteLayers();
@@ -579,7 +579,7 @@ void GraphicsManager::fixScaleSprite(int x, int y, Sprite &single, const SpriteP
 		}
 	} else {
 		int d = useZB ? y + _cameraY : (y + _cameraY > _sceneHeight * 0.6 ? _sceneHeight + 1 : 0);
-		addSpriteDepth(&single.surface, d, x1, y1, (mirror ? Graphics::FLIP_H : Graphics::FLIP_NONE), diffX, diffY, ptr);
+		addSpriteDepth(&single.surface, d, x1, y1, (mirror ? Graphics::FLIP_H : Graphics::FLIP_NONE), diffX, diffY, ptr, 255 - thisPerson->transparency);
 	}
 
 	// draw all
diff --git a/engines/sludge/sprites.h b/engines/sludge/sprites.h
index e18d16e5df..399e044b3d 100644
--- a/engines/sludge/sprites.h
+++ b/engines/sludge/sprites.h
@@ -92,9 +92,10 @@ struct SpriteDisplay {
 	bool freeAfterUse;
 	Graphics::FLIP_FLAGS flip;
 	Graphics::Surface *surface;
+	byte transparency;
 
-	SpriteDisplay(int xpos, int ypos, Graphics::FLIP_FLAGS f, Graphics::Surface *ptr, int w = -1, int h = 1, bool free = false) :
-			x(xpos), y(ypos), flip(f), surface(ptr), width(w), height(h), freeAfterUse(free) {
+	SpriteDisplay(int xpos, int ypos, Graphics::FLIP_FLAGS f, Graphics::Surface *ptr, int w = -1, int h = 1, bool free = false, byte trans = 255) :
+			x(xpos), y(ypos), flip(f), surface(ptr), width(w), height(h), freeAfterUse(free), transparency(trans) {
 	}
 };
 




More information about the Scummvm-git-logs mailing list