[Scummvm-cvs-logs] scummvm master -> 8f9b81104f061625531da29e80ce208370b44551

digitall dgturner at iee.org
Fri Sep 7 05:00:38 CEST 2012


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:
33cdddb7ec CINE: Implement proper text coloring in selection menus for Amiga.
da4e3c4f2a CINE: Make selection menu focus rectangle match the original size.
855a0d331f CINE: Explain the name "undrawChar" and add a possible TODO.
8f9b81104f Merge pull request #277 from lordhoto/cine-amiga-menu


Commit: 33cdddb7ec48f208d8873120c93aca1c17d7026f
    https://github.com/scummvm/scummvm/commit/33cdddb7ec48f208d8873120c93aca1c17d7026f
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-09-06T15:19:23-07:00

Commit Message:
CINE: Implement proper text coloring in selection menus for Amiga.

Tested with FW Amiga.

Changed paths:
    engines/cine/gfx.cpp
    engines/cine/gfx.h



diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 7a98822..b5b4272 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -471,6 +471,38 @@ int FWRenderer::drawChar(char character, int x, int y) {
 	return x;
 }
 
+/**
+ * Clears the character glyph to black
+ * @param character Character to undraw
+ * @param x Character coordinate
+ * @param y Character coordinate
+ */
+int FWRenderer::undrawChar(char character, int x, int y) {
+	int width, idx;
+
+	if (character == ' ') {
+		x += 5;
+	} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
+		idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+		const byte *sprite = g_cine->_textHandler.textTable[idx][FONT_DATA];
+		for (uint i = 0; i < FONT_HEIGHT; ++i) {
+			byte *dst = _backBuffer + (y + i) * 320 + x;
+			for (uint j = 0; j < FONT_WIDTH; ++j, ++dst) {
+				// The original does this based on whether bit 1 of the pixel
+				// is set. Since that's the only bit ever set in (FW) this
+				// check should be fine.
+				// TODO: Check how Operation Stealth Amiga works
+				if (*sprite++) {
+					*dst = 0;
+				}
+			}
+		}
+		x += width + 1;
+	}
+
+	return x;
+}
+
 int FWRenderer::getStringWidth(const char *str) {
 	const char *p = str;
 	int width = 0;
@@ -970,19 +1002,20 @@ void SelectionMenu::drawMenu(FWRenderer &r, bool top) {
 
 		if (i == _selection) {
 			if (isAmiga) {
-				// The original Amiga version is using a different highlight color here,
-				// but with our current code it is not possible to change the text color,
-				// thus we can not use the Amiga's color, since otherwise the text
-				// wouldn't be visible anymore.
-				r.drawPlainBox(charX, lineY, _width - 8, FONT_HEIGHT, top ? r._messageBg/*2*/ : 18);
+				r.drawPlainBox(charX, lineY, _width - 8, FONT_HEIGHT, top ? 2 : 18);
 			} else {
 				r.drawPlainBox(charX, lineY, _width - 8, 9, 0);
 			}
 		}
 
 		const int size = _elements[i].size();
-		for (int j = 0; j < size; ++j)
-			charX = r.drawChar(_elements[i][j], charX, lineY);
+		for (int j = 0; j < size; ++j) {
+			if (isAmiga && i == _selection) {
+				charX = r.undrawChar(_elements[i][j], charX, lineY);
+			} else {
+				charX = r.drawChar(_elements[i][j], charX, lineY);
+			}
+		}
 	}
 }
 
diff --git a/engines/cine/gfx.h b/engines/cine/gfx.h
index 3434cf9..10bf273 100644
--- a/engines/cine/gfx.h
+++ b/engines/cine/gfx.h
@@ -152,6 +152,7 @@ protected:
 	void drawBorder(int x, int y, int width, int height, byte color);
 	void drawDoubleBorder(int x, int y, int width, int height, byte color);
 	virtual int drawChar(char character, int x, int y);
+	virtual int undrawChar(char character, int x, int y);
 	void drawLine(int x, int y, int width, int height, byte color);
 	void remaskSprite(byte *mask, Common::List<overlay>::iterator it);
 	virtual void drawBackground();


Commit: da4e3c4f2aa2f426971f9213f98486d8e484e2b8
    https://github.com/scummvm/scummvm/commit/da4e3c4f2aa2f426971f9213f98486d8e484e2b8
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-09-06T15:40:42-07:00

Commit Message:
CINE: Make selection menu focus rectangle match the original size.

Compared against real FW Amiga under UAE and FW Dos under DOSBox.

Changed paths:
    engines/cine/gfx.cpp



diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index b5b4272..030bee4 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -1001,11 +1001,19 @@ void SelectionMenu::drawMenu(FWRenderer &r, bool top) {
 		charX = x + 4;
 
 		if (i == _selection) {
+			int color;
+
 			if (isAmiga) {
-				r.drawPlainBox(charX, lineY, _width - 8, FONT_HEIGHT, top ? 2 : 18);
+				if (top) {
+					color = 2;
+				} else {
+					color = 18;
+				}
 			} else {
-				r.drawPlainBox(charX, lineY, _width - 8, 9, 0);
+				color = 0;
 			}
+
+			r.drawPlainBox(x + 2, lineY - 1, _width - 3, 9, color);
 		}
 
 		const int size = _elements[i].size();


Commit: 855a0d331fa7d0ba8745c43e0e2311717987e33d
    https://github.com/scummvm/scummvm/commit/855a0d331fa7d0ba8745c43e0e2311717987e33d
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-09-06T15:52:59-07:00

Commit Message:
CINE: Explain the name "undrawChar" and add a possible TODO.

Changed paths:
    engines/cine/gfx.cpp



diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 030bee4..6e313ab 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -473,6 +473,9 @@ int FWRenderer::drawChar(char character, int x, int y) {
 
 /**
  * Clears the character glyph to black
+ * This function is called "undrawChar", because the original only applies
+ * this drawing after the original glyph has been drawn.
+ * Possible TODO: Find a better name.
  * @param character Character to undraw
  * @param x Character coordinate
  * @param y Character coordinate


Commit: 8f9b81104f061625531da29e80ce208370b44551
    https://github.com/scummvm/scummvm/commit/8f9b81104f061625531da29e80ce208370b44551
Author: David Turner (dgturner at iee.org)
Date: 2012-09-06T20:00:00-07:00

Commit Message:
Merge pull request #277 from lordhoto/cine-amiga-menu

Improvements for Cine's selection menu.

Changed paths:
    engines/cine/gfx.cpp
    engines/cine/gfx.h









More information about the Scummvm-git-logs mailing list