[Scummvm-cvs-logs] scummvm master -> e15dafb9e4f15a1c9095b02bca0d240de9bd2f09

urukgit urukgit at users.noreply.github.com
Tue Feb 25 21:57:07 CET 2014


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:
e15dafb9e4 AVALANCHE: Rework use of Common::Rect.


Commit: e15dafb9e4f15a1c9095b02bca0d240de9bd2f09
    https://github.com/scummvm/scummvm/commit/e15dafb9e4f15a1c9095b02bca0d240de9bd2f09
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-25T12:56:32-08:00

Commit Message:
AVALANCHE: Rework use of Common::Rect.

Now the right and bottom coordinates of the rectangles aren't included in them.

Changed paths:
    engines/avalanche/ghostroom.cpp
    engines/avalanche/graphics.cpp
    engines/avalanche/graphics.h
    engines/avalanche/help.cpp
    engines/avalanche/nim.cpp
    engines/avalanche/shootemup.cpp



diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp
index 91b2bae..1419a0c 100644
--- a/engines/avalanche/ghostroom.cpp
+++ b/engines/avalanche/ghostroom.cpp
@@ -230,12 +230,12 @@ void GhostRoom::run() {
 		int xBound = x % 30;
 		if ((22 <= xBound) && (xBound <= 27)) {
 			if (xBound == 27)
-				_vm->_graphics->drawFilledRectangle(Common::Rect(x, 135, x + 16, 136), kColorBlack);
+				_vm->_graphics->drawFilledRectangle(Common::Rect(x, 135, x + 17, 137), kColorBlack);
 			_vm->_graphics->ghostDrawPicture(_eyes[0], x, 136);
 			_vm->_graphics->drawDot(x + 16, 137, kColorBlack);
 		} else {
 			if (xBound == 21)
-				_vm->_graphics->drawFilledRectangle(Common::Rect(x, 137, x + 17, 138), kColorBlack);
+				_vm->_graphics->drawFilledRectangle(Common::Rect(x, 137, x + 18, 139), kColorBlack);
 			_vm->_graphics->ghostDrawPicture(_eyes[0], x, 135);
 			_vm->_graphics->drawDot(x + 16, 136, kColorBlack); // Eyes would leave a trail 1 pixel high behind them.
 		}
@@ -257,7 +257,7 @@ void GhostRoom::run() {
 	}
 
 	// Blank out the Glerk's space.
-	_vm->_graphics->drawFilledRectangle(Common::Rect(456, 14, 530, 50), kColorBlack);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(456, 14, 531, 51), kColorBlack);
 	_vm->_graphics->refreshScreen();
 
 
@@ -265,7 +265,7 @@ void GhostRoom::run() {
 	for (int y = -64; y <= 103; y++) {
 		_vm->_graphics->ghostDrawGhost(_ghost[1 + (abs(y / 7) % 2) * 3], 0, y);
 		if (y > 0)
-			_vm->_graphics->drawFilledRectangle(Common::Rect(0, y - 1, 26 * 8, y), kColorBlack);
+			_vm->_graphics->drawFilledRectangle(Common::Rect(0, y - 1, 26 * 8 + 1, y + 1), kColorBlack);
 		_vm->_graphics->refreshScreen();
 
 		wait(27);
@@ -276,7 +276,7 @@ void GhostRoom::run() {
 
 	for (int i = 0; i < 4; i++) {
 		for (int j = 0; j < 5; j++) {
-			_vm->_graphics->drawFilledRectangle(Common::Rect(0, 96, 26 * 8, 169), kColorBlack);
+			_vm->_graphics->drawFilledRectangle(Common::Rect(0, 96, 26 * 8, 170), kColorBlack);
 			_vm->_graphics->ghostDrawGhost(_ghost[kWaveOrder[j]], 0, 96 + kAdjustment[j]);
 
 			_aarghCount++;
@@ -298,7 +298,7 @@ void GhostRoom::run() {
 	wait(777);
 
 	// Erase "aargh":
-	_vm->_graphics->drawFilledRectangle(Common::Rect(172, 78, 347, 111), kColorBlack);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(172, 78, 348, 112), kColorBlack);
 	_vm->_graphics->refreshScreen();
 
 	for (int i = 4; i >= 0; i--) {
@@ -307,7 +307,7 @@ void GhostRoom::run() {
 	}
 
 	// Erase the exclamation mark:
-	_vm->_graphics->drawFilledRectangle(Common::Rect(246, 127, 251, 133), kColorBlack);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(246, 127, 252, 134), kColorBlack);
 	_vm->_graphics->refreshScreen();
 
 	// Avvy hurries back:
@@ -320,12 +320,12 @@ void GhostRoom::run() {
 		int xBound = x % 30;
 		if ((22 <= xBound) && (xBound <= 27)) {
 			if (xBound == 22)
-				_vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 134, x + 38, 137), kColorBlack);
+				_vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 134, x + 39, 138), kColorBlack);
 			_vm->_graphics->ghostDrawPicture(_eyes[1], x + 23, 136);
 			_vm->_graphics->drawDot(x + 22, 137, kColorBlack);
 		} else {
 			if (xBound == 28)
-				_vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 135, x + 38, 138), kColorBlack);
+				_vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 135, x + 39, 139), kColorBlack);
 			_vm->_graphics->ghostDrawPicture(_eyes[1], x + 23, 135);
 			_vm->_graphics->drawDot(x + 22, 136, kColorBlack); // Eyes would leave a trail 1 pixel high behind them.
 		}
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 603e294..9510f4f 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -479,15 +479,15 @@ void GraphicManager::drawDebugLines() {
 }
 
 void GraphicManager::drawRectangle(Common::Rect rect, Color color) {
-	_surface.frameRect(Common::Rect(rect.left, rect.top, rect.right + 1, rect.bottom + 1), color);
+	_surface.frameRect(rect, color);
 }
 
 void GraphicManager::drawFilledRectangle(Common::Rect rect, Color color) {
-	_surface.fillRect(Common::Rect(rect.left, rect.top, rect.right + 1, rect.bottom + 1), color);
+	_surface.fillRect(rect, color);
 }
 
 void GraphicManager::blackOutScreen() {
-	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlack);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack);
 }
 
 void GraphicManager::nimLoad() {
@@ -691,7 +691,7 @@ void GraphicManager::helpDrawHighlight(byte which, Color color) {
 		return;
 
 	which &= 31;
-	drawRectangle(Common::Rect(466, 38 + which * 27, 555, 62 + which * 27), color);
+	drawRectangle(Common::Rect(466, 38 + which * 27, 556, 63 + which * 27), color);
 }
 
 /**
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 86244e9..acc0c92 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -59,8 +59,6 @@ public:
 	void loadDigits();
 	void loadMouse(byte which);
 
-	// We have to handle the drawing of rectangles a little bit differently to mimic Pascal's bar() and rectangle() methods properly.
-	// Now it is possible to use the original coordinates everywhere.
 	void drawRectangle(Common::Rect rect, Color color);
 	void drawFilledRectangle(Common::Rect rect, Color color);
 	void blackOutScreen();
diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp
index 5d3247b..b24f6c4 100644
--- a/engines/avalanche/help.cpp
+++ b/engines/avalanche/help.cpp
@@ -66,8 +66,8 @@ void Help::switchPage(byte which) {
 
 	Common::String title = getLine(file);
 
-	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlue);
-	_vm->_graphics->drawFilledRectangle(Common::Rect(8, 40, 449, 199), kColorWhite);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlue);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(8, 40, 450, 200), kColorWhite);
 
 	byte index = file.readByte();
 	_vm->_graphics->helpDrawButton(-177, index);
diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp
index 87af805..9457a50 100644
--- a/engines/avalanche/nim.cpp
+++ b/engines/avalanche/nim.cpp
@@ -152,13 +152,13 @@ void Nim::setup() {
 	_vm->fadeIn();
 	_vm->_graphics->nimLoad();
 
-	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlack);
+	_vm->_graphics->blackOutScreen();
 	// Upper left rectangle.
-	_vm->_graphics->drawRectangle(Common::Rect(10, 5, 380, 70), kColorRed);
-	_vm->_graphics->drawFilledRectangle(Common::Rect(11, 6, 379, 69), kColorBrown);
+	_vm->_graphics->drawRectangle(Common::Rect(10, 5, 381, 71), kColorRed);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(11, 6, 380, 70), kColorBrown);
 	// Bottom right rectangle.
-	_vm->_graphics->drawRectangle(Common::Rect(394, 50, 634, 197), kColorRed);
-	_vm->_graphics->drawFilledRectangle(Common::Rect(395, 51, 633, 196), kColorBrown);
+	_vm->_graphics->drawRectangle(Common::Rect(394, 50, 635, 198), kColorRed);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(395, 51, 634, 197), kColorBrown);
 		
 	_vm->_graphics->nimDrawLogo();
 	_vm->_graphics->nimDrawInitials();
@@ -383,8 +383,8 @@ void Nim::takeSome() {
 
 		int x1 = 63 + (_stones[_row] - _number) * 64;
 		int y1 = 38 + 35 * (_row + 1);
-		int x2 = 54 + _stones[_row] * 64;
-		int y2 = 63 + 35 * (_row + 1);
+		int x2 = 55 + _stones[_row] * 64;
+		int y2 = 64 + 35 * (_row + 1);
 		_vm->_graphics->drawRectangle(Common::Rect(x1, y1, x2, y2), kColorBlue); // Draw the selection rectangle.
 		_vm->_graphics->refreshScreen();
 
@@ -396,8 +396,8 @@ void Nim::takeSome() {
 				_vm->_graphics->drawRectangle(Common::Rect(x1, y1, x2, y2), kColorBlack); // Erase the previous selection.
 				x1 = 63 + (_stones[_row] - _number) * 64;
 				y1 = 38 + 35 * (_row + 1);
-				x2 = 54 + _stones[_row] * 64;
-				y2 = 63 + 35 * (_row + 1);
+				x2 = 55 + _stones[_row] * 64;
+				y2 = 64 + 35 * (_row + 1);
 				_vm->_graphics->drawRectangle(Common::Rect(x1, y1, x2, y2), kColorBlue); // Draw the new one.
 				_vm->_graphics->refreshScreen();
 			}
diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index f50be51..c14961a 100644
--- a/engines/avalanche/shootemup.cpp
+++ b/engines/avalanche/shootemup.cpp
@@ -300,7 +300,7 @@ void ShootEmUp::nextPage() {
 		}
 	}
 
-	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlack);
+	_vm->_graphics->blackOutScreen();
 }
 
 void ShootEmUp::instructions() {






More information about the Scummvm-git-logs mailing list