[Scummvm-cvs-logs] scummvm master -> 589c6ffed25e818cd332e3ffb462ee13c4c8703e

urukgit urukgit at users.noreply.github.com
Tue Feb 18 13:57:18 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:
589c6ffed2 AVALANCHE: Reimplement the rectangle drawing methods.


Commit: 589c6ffed25e818cd332e3ffb462ee13c4c8703e
    https://github.com/scummvm/scummvm/commit/589c6ffed25e818cd332e3ffb462ee13c4c8703e
Author: uruk (koppirnyo at gmail.com)
Date: 2014-02-18T04:56:19-08:00

Commit Message:
AVALANCHE: Reimplement the rectangle drawing methods.

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 3323e53..5942c55 100644
--- a/engines/avalanche/ghostroom.cpp
+++ b/engines/avalanche/ghostroom.cpp
@@ -209,7 +209,7 @@ void GhostRoom::run() {
 	CursorMan.showMouse(false);
 	_vm->_graphics->saveScreen();
 	_vm->fadeOut();
-	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); // Black out the whole screen.
+	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlack); // Black out the whole screen.
 	_vm->fadeIn();
 
 	// Only load the pictures if it's our first time walking into the room.
@@ -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 + 17, 137), kColorBlack);
+				_vm->_graphics->drawFilledRectangle(Common::Rect(x, 135, x + 16, 136), 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 + 18, 139), kColorBlack);
+				_vm->_graphics->drawFilledRectangle(Common::Rect(x, 137, x + 17, 138), 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.
 		}
@@ -298,7 +298,7 @@ void GhostRoom::run() {
 	wait(777);
 
 	// Erase "aargh":
-	_vm->_graphics->drawFilledRectangle(Common::Rect(172, 78, 348, 112), kColorBlack);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(172, 78, 347, 111), 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, 252, 134), kColorBlack);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(246, 127, 251, 133), 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, 138), kColorBlack);
+				_vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 134, x + 38, 137), 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, 139), kColorBlack);
+				_vm->_graphics->drawFilledRectangle(Common::Rect(x + 22, 135, x + 38, 138), 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 1e3a6ff..ca9409d 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -479,11 +479,11 @@ void GraphicManager::drawDebugLines() {
 }
 
 void GraphicManager::drawFilledRectangle(Common::Rect rect, Color color) {
-	_surface.fillRect(rect, color);
+	_surface.fillRect(Common::Rect(rect.left, rect.top, rect.right + 1, rect.bottom + 1), color);
 }
 
 void GraphicManager::drawRectangle(Common::Rect rect, Color color) {
-	_surface.frameRect(rect, color);
+	_surface.frameRect(Common::Rect(rect.left, rect.top, rect.right + 1, rect.bottom + 1), color);
 }
 
 void GraphicManager::nimLoad() {
@@ -687,7 +687,7 @@ void GraphicManager::helpDrawHighlight(byte which, Color color) {
 		return;
 
 	which &= 31;
-	drawRectangle(Common::Rect(466, 38 + which * 27, 555, 63 + which * 27), color);
+	drawRectangle(Common::Rect(466, 38 + which * 27, 555, 62 + which * 27), color);
 }
 
 /**
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 05bd507..b720ae7 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -59,13 +59,15 @@ 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 drawFilledRectangle(Common::Rect rect, Color color);
+	void drawRectangle(Common::Rect rect, Color color);
 	void drawDot(int x, int y, Color color);
 	void drawLine(int x1, int y1, int x2, int y2, int penX, int penY, Color color);
 	Common::Point drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
 	void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
 	void drawTriangle(Common::Point *p, Color color);
-	void drawFilledRectangle(Common::Rect rect, Color color);
-	void drawRectangle(Common::Rect rect, Color color);
 	void drawNormalText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
 	void drawBigText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); // Very similar to drawText. TODO: Try to unify the two.
 	void drawScrollText(const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp
index bef557d..b667ad0 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, 640, 200), kColorBlue);
-	_vm->_graphics->drawFilledRectangle(Common::Rect(8, 40, 450, 200), kColorWhite);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlue);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(8, 40, 449, 199), kColorWhite);
 
 	byte index = file.readByte();
 	_vm->_graphics->helpDrawButton(-177, index);
diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp
index 1430b69..87af805 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, 640, 200), kColorBlack);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlack);
 	// Upper left rectangle.
-	_vm->_graphics->drawRectangle(Common::Rect(10, 5, 381, 71), kColorRed);
-	_vm->_graphics->drawFilledRectangle(Common::Rect(11, 6, 380, 70), kColorBrown);
+	_vm->_graphics->drawRectangle(Common::Rect(10, 5, 380, 70), kColorRed);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(11, 6, 379, 69), kColorBrown);
 	// Bottom right rectangle.
-	_vm->_graphics->drawRectangle(Common::Rect(394, 50, 635, 198), kColorRed);
-	_vm->_graphics->drawFilledRectangle(Common::Rect(395, 51, 634, 197), kColorBrown);
+	_vm->_graphics->drawRectangle(Common::Rect(394, 50, 634, 197), kColorRed);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(395, 51, 633, 196), kColorBrown);
 		
 	_vm->_graphics->nimDrawLogo();
 	_vm->_graphics->nimDrawInitials();
diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index 3012813..cd46d00 100644
--- a/engines/avalanche/shootemup.cpp
+++ b/engines/avalanche/shootemup.cpp
@@ -202,11 +202,11 @@ void ShootEmUp::nextPage() {
 		}
 	}
 
-	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack);
+	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlack);
 }
 
 void ShootEmUp::instructions() {
-	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); // Black out the whole screen.
+	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlack); // Black out the whole screen.
 	_vm->_graphics->seuDrawPicture(25, 25, kFacingRight);
 	_vm->_graphics->drawNormalText("< Avvy, our hero, needs your help - you must move him around.", _vm->_font, 8, 60, 35, kColorWhite);
 	_vm->_graphics->drawNormalText("(He''s too terrified to move himself!)", _vm->_font, 8, 80, 45, kColorWhite);
@@ -270,7 +270,7 @@ void ShootEmUp::setup() {
 
 	_count321 = 255; // Counting down.
 
-	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack); // Black out the whole screen.
+	_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 639, 199), kColorBlack); // Black out the whole screen.
 
 	// Set up status line:
 	_vm->_graphics->seuDrawPicture(0, 0, 16); // Score:






More information about the Scummvm-git-logs mailing list