[Scummvm-cvs-logs] scummvm master -> 2e56baeca0ad9067f73a03c81a161e05acda7abe

urukgit urukgit at users.noreply.github.com
Tue Feb 18 15:47:56 CET 2014


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:
72c40dbd47 AVALANCHE: Repair writing off the boundaries in loadPictureGraphic().
2e56baeca0 AVALANCHE: Rework GraphicManager::loadPictureSign().


Commit: 72c40dbd47b8684358432567cd20cbd3b9af92b8
    https://github.com/scummvm/scummvm/commit/72c40dbd47b8684358432567cd20cbd3b9af92b8
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-18T06:42:31-08:00

Commit Message:
AVALANCHE: Repair writing off the boundaries in loadPictureGraphic().

Changed paths:
    engines/avalanche/graphics.cpp



diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 4bd6695..367ca27 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -790,7 +790,10 @@ Graphics::Surface GraphicManager::loadPictureGraphic(Common::File &file) {
 				byte pixel = file.readByte();
 				for (int bit = 0; bit < 8; bit++) {
 					byte pixelBit = (pixel >> bit) & 1;
-					*(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane);
+					// If the picture's width is not a multiple of 8, and we get over the boundary with the 'x' cycle, pixelBit is surely == 0.
+					// Otherwise, it doesn't cause trouble, since addign 0 doesn't have an effect at all.
+					if (pixelBit != 0)
+						*(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane);
 				}
 			}
 		}


Commit: 2e56baeca0ad9067f73a03c81a161e05acda7abe
    https://github.com/scummvm/scummvm/commit/2e56baeca0ad9067f73a03c81a161e05acda7abe
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-18T06:47:17-08:00

Commit Message:
AVALANCHE: Rework GraphicManager::loadPictureSign().

Changed paths:
    engines/avalanche/graphics.cpp
    engines/avalanche/graphics.h



diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 367ca27..cde0f5d 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -826,22 +826,21 @@ Graphics::Surface GraphicManager::loadPictureRaw(Common::File &file, uint16 widt
 	return picture;
 }
 
-Graphics::Surface GraphicManager::loadPictureSign(Common::File &file, int xl, int yl) {
+Graphics::Surface GraphicManager::loadPictureSign(Common::File &file, uint16 width, uint16 height) {
 	// I know it looks very similar to the other loadPicture methods, but in truth it's the combination of the two.
-	uint16 width = xl * 8;
-	uint16 height = yl;
+	width *= 8;
 
 	Graphics::Surface picture; // We make a Surface object for the picture itself.
 	picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 
 	// Produce the picture. We read it in row-by-row, and every row has 4 planes.
-	for (int yy = 0; yy < height; yy++) {
+	for (int y = 0; y < height; y++) {
 		for (int8 plane = 0; plane < 4; plane++) { // The planes are in the "right" order.
-			for (uint16 xx = 0; xx < width; xx += 8) {
+			for (uint16 x = 0; x < width; x += 8) {
 				byte pixel = file.readByte();
 				for (int bit = 0; bit < 8; bit++) {
 					byte pixelBit = (pixel >> bit) & 1;
-					*(byte *)picture.getBasePtr(xx + 7 - bit, yy) += (pixelBit << plane);
+					*(byte *)picture.getBasePtr(x + 7 - bit, y) += (pixelBit << plane);
 				}
 			}
 		}
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 34f6498..1da875b 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -180,7 +180,7 @@ private:
 
 	// Further information about these two: http://www.shikadi.net/moddingwiki/Raw_EGA_data
 	Graphics::Surface loadPictureGraphic(Common::File &file); // Reads Graphic-planar EGA data.
-	Graphics::Surface loadPictureSign(Common::File &file, int xl, int yl); // Reads a tricky type of picture used for the "game over"/"about" scrolls and in the mini-game Nim.
+	Graphics::Surface loadPictureSign(Common::File &file, uint16 width, uint16 height); // Reads a tricky type of picture used for the "game over"/"about" scrolls and in the mini-game Nim.
 
 	void drawText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
 	void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY);






More information about the Scummvm-git-logs mailing list