[Scummvm-git-logs] scummvm master -> 90dc392f823a0df5932fb5f4c22f61f997eeaa18

Mataniko mataniko at gmail.com
Mon May 4 04:13:53 UTC 2020


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:
90dc392f82 SCUMM: Render dark rooms and flashlight accurately in MM NES


Commit: 90dc392f823a0df5932fb5f4c22f61f997eeaa18
    https://github.com/scummvm/scummvm/commit/90dc392f823a0df5932fb5f4c22f61f997eeaa18
Author: mataniko (mataniko at gmail.com)
Date: 2020-05-04T00:05:47-04:00

Commit Message:
SCUMM: Render dark rooms and flashlight accurately in MM NES
The flashlight in MM NES does not have rounded corners, and due to
palette limitations does not render the lit areas in color.

This commit also adjusts the palette for sprites in dark rooms to match
a real NES.

Changed paths:
    engines/scumm/costume.cpp
    engines/scumm/gfx.cpp


diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index cd0d15e590..7eab3c2ba3 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -757,7 +757,7 @@ void ClassicCostumeLoader::loadCostume(int id) {
 }
 
 byte NESCostumeRenderer::drawLimb(const Actor *a, int limb) {
-	const byte darkpalette[16] = {0x00,0x00,0x2D,0x3D,0x00,0x00,0x2D,0x3D,0x00,0x00,0x2D,0x3D,0x00,0x00,0x2D,0x3D};
+	const byte darkpalette[16] = { 0x2d,0x1d,0x2d,0x3d, 0x2d,0x1d,0x2d,0x3d, 0x2d,0x1d,0x2d,0x3d, 0x2d,0x1d,0x2d,0x3d };
 	const CostumeData &cost = a->_cost;
 	const byte *palette, *src, *sprdata;
 	int anim, frameNum, frame, offset, numSprites;
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index b140c9a04f..7957f50020 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -1487,9 +1487,8 @@ void ScummEngine_v5::drawFlashlight() {
 
 	blit(_flashlight.buffer, vs->pitch, bgbak, vs->pitch, _flashlight.w, _flashlight.h, vs->format.bytesPerPixel);
 
-	// C64 does not round the flashlight
-	if (_game.platform != Common::kPlatformC64) {
-
+	// C64 & NES does not round the flashlight
+	if (_game.platform != Common::kPlatformC64 && _game.platform != Common::kPlatformNES) {
 		// Round the corners. To do so, we simply hard-code a set of nicely
 		// rounded corners.
 		static const int corner_data[] = { 8, 6, 4, 3, 2, 2, 1, 1 };
@@ -2741,10 +2740,18 @@ void GdiNES::decodeNESObject(const byte *ptr, int xpos, int ypos, int width, int
 }
 
 void GdiNES::drawStripNES(byte *dst, byte *mask, int dstPitch, int stripnr, int top, int height) {
+	const byte darkPalette[16] = { 0x2d,0x1d,0x3d,0x20, 0x2d,0x1d,0x3d,0x20, 0x2d,0x1d,0x3d,0x20, 0x2d,0x1d,0x3d,0x20 };
+	const byte* stripPalette;
 	top /= 8;
 	height /= 8;
 	int x = stripnr + 2;	// NES version has a 2 tile gap on each edge
 
+	// MM NES does not paint the background when lit with a flashlight
+	if (_vm->isLightOn())
+		stripPalette = _vm->_NESPalette[0];
+	else
+		stripPalette = darkPalette;
+
 	if (_objectMode)
 		x += _NES.objX; // for objects, need to start at the left edge of the object, not the screen
 	if (x > 63) {
@@ -2759,7 +2766,7 @@ void GdiNES::drawStripNES(byte *dst, byte *mask, int dstPitch, int stripnr, int
 			byte c0 = _vm->_NESPatTable[1][tile * 16 + i];
 			byte c1 = _vm->_NESPatTable[1][tile * 16 + i + 8];
 			for (int j = 0; j < 8; j++)
-				dst[j] = _vm->_NESPalette[0][((c0 >> (7 - j)) & 1) | (((c1 >> (7 - j)) & 1) << 1) | (palette << 2)];
+				dst[j] = stripPalette[((c0 >> (7 - j)) & 1) | (((c1 >> (7 - j)) & 1) << 1) | (palette << 2)];
 			dst += dstPitch;
 			*mask = c0 | c1;
 			mask += _numStrips;




More information about the Scummvm-git-logs mailing list