aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-02-18 13:53:20 +0100
committeruruk2014-02-18 13:56:19 +0100
commit589c6ffed25e818cd332e3ffb462ee13c4c8703e (patch)
tree30b072409c665eae74e77a7baceb34af8ba65b0d
parent36ac801a4da38a2454ebc7a305093f8ed66cd1b3 (diff)
downloadscummvm-rg350-589c6ffed25e818cd332e3ffb462ee13c4c8703e.tar.gz
scummvm-rg350-589c6ffed25e818cd332e3ffb462ee13c4c8703e.tar.bz2
scummvm-rg350-589c6ffed25e818cd332e3ffb462ee13c4c8703e.zip
AVALANCHE: Reimplement the rectangle drawing methods.
-rw-r--r--engines/avalanche/ghostroom.cpp14
-rw-r--r--engines/avalanche/graphics.cpp6
-rw-r--r--engines/avalanche/graphics.h6
-rw-r--r--engines/avalanche/help.cpp4
-rw-r--r--engines/avalanche/nim.cpp10
-rw-r--r--engines/avalanche/shootemup.cpp6
6 files changed, 24 insertions, 22 deletions
diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp
index 3323e538ef..5942c5565c 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 1e3a6ff36c..ca9409d25d 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 05bd507d8e..b720ae7c8e 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 bef557db07..b667ad090d 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 1430b69ea9..87af8053e1 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 3012813d70..cd46d00333 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: