diff options
Diffstat (limited to 'engines/mortevielle')
-rw-r--r-- | engines/mortevielle/boite.cpp | 32 | ||||
-rw-r--r-- | engines/mortevielle/graphics.cpp | 39 | ||||
-rw-r--r-- | engines/mortevielle/graphics.h | 2 |
3 files changed, 38 insertions, 35 deletions
diff --git a/engines/mortevielle/boite.cpp b/engines/mortevielle/boite.cpp index 6e2976964d..e2b8200adc 100644 --- a/engines/mortevielle/boite.cpp +++ b/engines/mortevielle/boite.cpp @@ -25,41 +25,17 @@ * Copyright (c) 1988-1989 Lankhor */ +#include "common/textconsole.h" #include "mortevielle/boite.h" -#include "mortevielle/mouse.h" -#include "mortevielle/var_mor.h" +#include "mortevielle/mortevielle.h" namespace Mortevielle { //Translation: box() void boite(int x, int y, int dx, int dy, int coul) { - int i; - int xi, yi, xo, yo; + warning("TODO: boite is deprecated in favour of ScreenSurface::drawBox"); - /* debug('boite'); */ - hide_mouse(); - if (res == 1) { - x = (uint)x >> 1; - dx = (uint)dx >> 1; - } - xi = x; - yi = y; - xo = x; - yo = y; - for (i = 0; i <= dx + dy; i ++) { - putpix(gd, xi, yi, coul); - if (xi == x + dx) { - if (gd != cga) putpix(gd, pred(int, xi), yi, coul); - yi = succ(int, yi); - } else xi = succ(int, xi); - putpix(gd, xo, yo, coul); - if (yo == y + dy) xo = succ(int, xo); - else { - if (gd != cga) putpix(gd, succ(int, xo), yo, coul); - yo = succ(int, yo); - } - } - show_mouse(); + g_vm->_screenSurface.drawBox(x, y, dx, dy, coul); } } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index 4be270ffa6..851e5df391 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -24,6 +24,8 @@ #include "common/system.h" #include "mortevielle/graphics.h" #include "mortevielle/mortevielle.h" +#include "mortevielle/mouse.h" +#include "mortevielle/var_mor.h" namespace Mortevielle { @@ -819,6 +821,7 @@ Graphics::Surface ScreenSurface::lockArea(const Common::Rect &bounds) { _dirtyRects.push_back(bounds); Graphics::Surface s; + s.format = format; s.pixels = getBasePtr(bounds.left, bounds.top); s.pitch = pitch; s.w = bounds.width(); @@ -845,8 +848,8 @@ void ScreenSurface::updateScreen() { /** * Draws a decoded picture on the screen - * @remarks Because the ScummVM surface is using a double height 640x200 surface to - * simulate the original 640x200 surface, all Y values have to be doubled. + * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * simulate the original 640x400 surface, all Y values have to be doubled. * Also, image resources are stored at 320x200, so when drawn onto the screen every * other column is interpolated. */ @@ -888,8 +891,8 @@ void ScreenSurface::drawPicture(GfxSurface &surface, int x, int y) { /** * Draws a character at the specified co-ordinates - * @remarks Because the ScummVM surface is using a double height 640x200 surface to - * simulate the original 640x200 surface, all Y values have to be doubled + * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex) { Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, @@ -914,9 +917,33 @@ void ScreenSurface::writeCharacter(const Common::Point &pt, unsigned char ch, in } /** + * Draws a box at the specified position and size + * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * simulate the original 640x400 surface, all Y values have to be doubled + */ +void ScreenSurface::drawBox(int x, int y, int dx, int dy, int col) { + if (res == 1) { + x = (uint)x >> 1; + dx = (uint)dx >> 1; + } + + Graphics::Surface destSurface = lockArea(Common::Rect(x, y * 2, x + dx, (y + dy) * 2)); + + destSurface.hLine(0, 0, dx, col); + destSurface.hLine(0, 1, dx, col); + destSurface.hLine(0, destSurface.h - 1, dx, col); + destSurface.hLine(0, destSurface.h - 2, dx, col); + destSurface.vLine(0, 2, destSurface.h - 3, col); + destSurface.vLine(1, 2, destSurface.h - 3, col); + destSurface.vLine(dx - 1, 2, destSurface.h - 3, col); + destSurface.vLine(dx - 2, 2, destSurface.h - 3, col); +} + + +/** * Sets a single pixel at the specified co-ordinates - * @remarks Because the ScummVM surface is using a double height 640x200 surface to - * simulate the original 640x200 surface, all Y values have to be doubled + * @remarks Because the ScummVM surface is using a double height 640x400 surface to + * simulate the original 640x400 surface, all Y values have to be doubled */ void ScreenSurface::setPixel(const Common::Point &pt, int palIndex) { Graphics::Surface destSurface = lockArea(Common::Rect(pt.x, pt.y * 2, pt.x + 1, (pt.y + 1) * 2)); diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 8f21cde86f..78c1637e58 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -76,7 +76,7 @@ public: void updateScreen(); void drawPicture(GfxSurface &surface, int x, int y); void writeCharacter(const Common::Point &pt, unsigned char ch, int palIndex); - + void drawBox(int x, int y, int dx, int dy, int col); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); }; |