diff options
author | Filippos Karapetis | 2015-12-24 12:08:51 +0200 |
---|---|---|
committer | Filippos Karapetis | 2015-12-24 12:08:51 +0200 |
commit | 7216bddd56d48a4e0ec1f92d9a261943eb8ea072 (patch) | |
tree | 5965fdbaeef17e7d70224551fefc40f501addc72 | |
parent | 05973b9b41e28d0f1cc81608aad0093d9efc5c60 (diff) | |
download | scummvm-rg350-7216bddd56d48a4e0ec1f92d9a261943eb8ea072.tar.gz scummvm-rg350-7216bddd56d48a4e0ec1f92d9a261943eb8ea072.tar.bz2 scummvm-rg350-7216bddd56d48a4e0ec1f92d9a261943eb8ea072.zip |
LAB: Merge setPen() into rectFill()
-rw-r--r-- | engines/lab/dispman.cpp | 109 | ||||
-rw-r--r-- | engines/lab/dispman.h | 10 | ||||
-rw-r--r-- | engines/lab/intro.cpp | 6 | ||||
-rw-r--r-- | engines/lab/map.cpp | 12 | ||||
-rw-r--r-- | engines/lab/special.cpp | 15 | ||||
-rw-r--r-- | engines/lab/tilepuzzle.cpp | 3 |
6 files changed, 59 insertions, 96 deletions
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 0457da876a..ead60f7a91 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -48,7 +48,6 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _actionMessageShown = false; _screenBytesPerPage = 0; - _curPen = 0; _curBitmap = nullptr; _displayBuffer = nullptr; _currentDisplayBuffer = nullptr; @@ -148,16 +147,12 @@ Common::String DisplayMan::getLine(TextFont *tf, const char **mainBuffer, uint16 int DisplayMan::flowText(TextFont *font, int16 spacing, byte penColor, byte backPen, bool fillBack, bool centerh, bool centerv, bool output, Common::Rect textRect, const char *str) { - if (fillBack) { - setPen(backPen); - rectFill(textRect); - } + if (fillBack) + rectFill(textRect, backPen); if (!str) return 0; - setPen(penColor); - TextFont *msgFont = font; uint16 fontHeight = textHeight(msgFont) + spacing; uint16 numLines = (textRect.height() + 1) / fontHeight; @@ -219,15 +214,13 @@ int DisplayMan::flowTextToMem(Image *destIm, TextFont *font, int16 spacing, byte void DisplayMan::createBox(uint16 y2) { // Message box area - setPen(7); - rectFillScaled(4, 154, 315, y2 - 2); + rectFillScaled(4, 154, 315, y2 - 2, 7); // Box around message area - setPen(0); - drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleX(317)); - drawVLine(_vm->_utils->vgaScaleX(317), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2)); - drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(y2), _vm->_utils->vgaScaleX(317)); - drawVLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2)); + drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleX(317), 0); + drawVLine(_vm->_utils->vgaScaleX(317), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2), 0); + drawHLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(y2), _vm->_utils->vgaScaleX(317), 0); + drawVLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2), 0); } int DisplayMan::longDrawMessage(Common::String str, bool isActionMessage) { @@ -247,8 +240,7 @@ int DisplayMan::longDrawMessage(Common::String str, bool isActionMessage) { if (!_longWinInFront) { _longWinInFront = true; // Clear Area - setPen(3); - rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); + rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199), 3); } createBox(198); @@ -289,52 +281,45 @@ void DisplayMan::drawPanel() { _vm->_event->mouseHide(); // Clear Area - setPen(3); - rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199)); + rectFill(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), _vm->_utils->vgaScaleY(199), 3); // First Line - setPen(0); - drawHLine(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); + drawHLine(0, _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), 0); // Second Line - setPen(5); - drawHLine(0, _vm->_utils->vgaScaleY(149) + 1 + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319)); + drawHLine(0, _vm->_utils->vgaScaleY(149) + 1 + _vm->_utils->svgaCord(2), _vm->_utils->vgaScaleX(319), 5); // Button Separators - setPen(0); - // First black line to separate buttons - drawHLine(0, _vm->_utils->vgaScaleY(170), _vm->_utils->vgaScaleX(319)); + drawHLine(0, _vm->_utils->vgaScaleY(170), _vm->_utils->vgaScaleX(319), 0); if (!_vm->_alternate) { - setPen(4); // The horizontal lines under the black one - drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); + drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319), 4); _vm->_event->drawButtonList(&_vm->_moveButtonList); } else { if (_vm->getPlatform() != Common::kPlatformWindows) { // Vertical Black lines - drawVLine(_vm->_utils->vgaScaleX(124), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); - drawVLine(_vm->_utils->vgaScaleX(194), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); + drawVLine(_vm->_utils->vgaScaleX(124), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199), 0); + drawVLine(_vm->_utils->vgaScaleX(194), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199), 0); } else { // Vertical Black lines - drawVLine(_vm->_utils->vgaScaleX(90), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); - drawVLine(_vm->_utils->vgaScaleX(160), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); - drawVLine(_vm->_utils->vgaScaleX(230), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199)); + drawVLine(_vm->_utils->vgaScaleX(90), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199), 0); + drawVLine(_vm->_utils->vgaScaleX(160), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199), 0); + drawVLine(_vm->_utils->vgaScaleX(230), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleY(199), 0); } - setPen(4); // The horizontal lines under the black one - drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(122)); - drawHLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(192)); - drawHLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319)); + drawHLine(0, _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(122), 4); + drawHLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(192), 4); + drawHLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 1, _vm->_utils->vgaScaleX(319), 4); // The vertical high light lines - drawVLine(_vm->_utils->vgaScaleX(1), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(1), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198), 4); if (_vm->getPlatform() != Common::kPlatformWindows) { - drawVLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); - drawVLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(126), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198), 4); + drawVLine(_vm->_utils->vgaScaleX(196), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198), 4); } else { - drawVLine(_vm->_utils->vgaScaleX(92), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); - drawVLine(_vm->_utils->vgaScaleX(162), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); - drawVLine(_vm->_utils->vgaScaleX(232), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198)); + drawVLine(_vm->_utils->vgaScaleX(92), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198), 4); + drawVLine(_vm->_utils->vgaScaleX(162), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198), 4); + drawVLine(_vm->_utils->vgaScaleX(232), _vm->_utils->vgaScaleY(170) + 2, _vm->_utils->vgaScaleY(198), 4); } _vm->_event->drawButtonList(&_vm->_invButtonList); @@ -400,11 +385,7 @@ void DisplayMan::setUpScreens() { delete invFile; } -void DisplayMan::setPen(byte penNum) { - _curPen = penNum; -} - -void DisplayMan::rectFill(Common::Rect fillRect) { +void DisplayMan::rectFill(Common::Rect fillRect, byte color) { int width = fillRect.width() + 1; int height = fillRect.height() + 1; @@ -422,7 +403,7 @@ void DisplayMan::rectFill(Common::Rect fillRect) { int ww = width; while (ww-- > 0) { - *dd++ = _curPen; + *dd++ = color; } d += _screenWidth; @@ -430,20 +411,20 @@ void DisplayMan::rectFill(Common::Rect fillRect) { } } -void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - rectFill(Common::Rect(x1, y1, x2, y2)); +void DisplayMan::rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte color) { + rectFill(Common::Rect(x1, y1, x2, y2), color); } -void DisplayMan::rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2) { - rectFill(_vm->_utils->vgaRectScale(x1, y1, x2, y2)); +void DisplayMan::rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte color) { + rectFill(_vm->_utils->vgaRectScale(x1, y1, x2, y2), color); } -void DisplayMan::drawVLine(uint16 x, uint16 y1, uint16 y2) { - rectFill(x, y1, x, y2); +void DisplayMan::drawVLine(uint16 x, uint16 y1, uint16 y2, byte color) { + rectFill(x, y1, x, y2, color); } -void DisplayMan::drawHLine(uint16 x1, uint16 y, uint16 x2) { - rectFill(x1, y, x2, y); +void DisplayMan::drawHLine(uint16 x1, uint16 y, uint16 x2, byte color) { + rectFill(x1, y, x2, y, color); } void DisplayMan::screenUpdate() { @@ -797,13 +778,11 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, const Common::String fi if (j == 0) checkerboardEffect(0, 0, curY, _screenWidth - 1, curY + 1); else - rectFill(0, curY, _screenWidth - 1, curY + 1); + rectFill(0, curY, _screenWidth - 1, curY + 1, 0); curY += 4; linesDone++; } // while } // for i - - setPen(0); } // for j if (filename.empty()) @@ -926,8 +905,7 @@ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint1 im.readScreenImage(x1, y1); im.drawImage(x1 + dx, y1); - setPen(0); - rectFill(x1, y1, x1 + dx - 1, y2); + rectFill(x1, y1, x1 + dx - 1, y2, 0); } else if (dx < 0) { im._width = x2 - x1 + 1 + dx; im._height = y2 - y1 + 1; @@ -935,8 +913,7 @@ void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint1 im.readScreenImage(x1 - dx, y1); im.drawImage(x1, y1); - setPen(0); - rectFill(x2 + dx + 1, y1, x2, y2); + rectFill(x2 + dx + 1, y1, x2, y2, 0); } // Prevent the Image destructor from deleting the external buffer @@ -960,8 +937,7 @@ void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint1 im.readScreenImage(x1, y1); im.drawImage(x1, y1 + dy); - setPen(0); - rectFill(x1, y1, x2, y1 + dy - 1); + rectFill(x1, y1, x2, y1 + dy - 1, 0); } else if (dy < 0) { im._width = x2 - x1 + 1; im._height = y2 - y1 + 1 + dy; @@ -969,8 +945,7 @@ void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint1 im.readScreenImage(x1, y1 - dy); im.drawImage(x1, y1); - setPen(0); - rectFill(x1, y2 + dy + 1, x2, y2); + rectFill(x1, y2 + dy + 1, x2, y2, 0); } // Prevent the Image destructor from deleting the external buffer diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index 8e9cfdff51..cbad419382 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -157,9 +157,9 @@ public: /** * Fills in a rectangle. */ - void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2); - void rectFill(Common::Rect fillRect); - void rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void rectFill(uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte color); + void rectFill(Common::Rect fillRect, byte color); + void rectFillScaled(uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte color); /** * Dumps a chunk of text to an arbitrary box; flows it within that box and * optionally centers it. Returns the number of characters that were processed. @@ -199,12 +199,12 @@ public: /** * Draws a vertical line. */ - void drawHLine(uint16 x, uint16 y1, uint16 y2); + void drawHLine(uint16 x, uint16 y1, uint16 y2, byte color); /** * Draws a horizontal line. */ - void drawVLine(uint16 x1, uint16 y, uint16 x2); + void drawVLine(uint16 x1, uint16 y, uint16 x2, byte color); void screenUpdate(); /** diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp index 95f9c0277f..5ed604c238 100644 --- a/engines/lab/intro.cpp +++ b/engines/lab/intro.cpp @@ -96,8 +96,7 @@ void Intro::doPictText(const Common::String filename, bool isScreen) { _vm->_graphics->fade(false); if (isScreen) { - _vm->_graphics->setPen(7); - _vm->_graphics->rectFillScaled(10, 10, 310, 190); + _vm->_graphics->rectFillScaled(10, 10, 310, 190, 7); curText += _vm->_graphics->flowText(_font, _vm->_isHiRes ? 0 : -1, 5, 7, false, false, true, true, _vm->_utils->vgaRectScale(14, 11, 306, 189), (char *)curText); _vm->_graphics->fade(true); @@ -431,8 +430,7 @@ void Intro::play() { nReadPict("SubX"); if (_quitIntro) { - _vm->_graphics->setPen(0); - _vm->_graphics->rectFill(0, 0, _vm->_graphics->_screenWidth - 1, _vm->_graphics->_screenHeight - 1); + _vm->_graphics->rectFill(0, 0, _vm->_graphics->_screenWidth - 1, _vm->_graphics->_screenHeight - 1, 0); _vm->_anim->_doBlack = true; } } diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 12df8ca4d7..fa657c0093 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -335,8 +335,7 @@ void LabEngine::drawMap(uint16 curRoom, uint16 curMsg, uint16 floorNum, bool fad if (fadeOut) _graphics->fade(false); - _graphics->setPen(0); - _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); _imgMap->drawImage(0, 0); _event->drawButtonList(&_mapButtonList); @@ -515,8 +514,7 @@ void LabEngine::processMap(uint16 curRoom) { const char *sptr; if ((sptr = _rooms[curMsg]._roomMsg.c_str())) { _event->mouseHide(); - _graphics->setPen(3); - _graphics->rectFillScaled(13, 148, 135, 186); + _graphics->rectFillScaled(13, 148, 135, 186, 3); _graphics->flowText(_msgFont, 0, 5, 3, true, true, true, true, _utils->vgaRectScale(14, 148, 134, 186), sptr); if (_maps[oldMsg]._pageNumber == curFloor) @@ -529,8 +527,7 @@ void LabEngine::processMap(uint16 curRoom) { top = bottom = (curCoords.top + curCoords.bottom) / 2; if ((curMsg != curRoom) && (_maps[curMsg]._pageNumber == curFloor)) { - _graphics->setPen(1); - _graphics->rectFill(left, top, right, bottom); + _graphics->rectFill(left, top, right, bottom, 1); } _event->mouseShow(); @@ -566,8 +563,7 @@ void LabEngine::doMap(uint16 curRoom) { _graphics->fade(false); _graphics->blackAllScreen(); _event->mouseHide(); - _graphics->setPen(0); - _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); freeMapData(); _graphics->blackAllScreen(); _event->mouseShow(); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 716628661c..301ed59065 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -288,8 +288,7 @@ void LabEngine::doJournal() { _screenImage->_imageData = _graphics->getCurrentDrawingBuffer(); - _graphics->setPen(0); - _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); _graphics->blackScreen(); } @@ -316,17 +315,14 @@ void LabEngine::drawMonText(const char *text, TextFont *monitorFont, Common::Rec else _monitorButtonHeight = fheight; - _graphics->setPen(0); - _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, textRect.bottom); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, textRect.bottom, 0); for (int i = 0; i < numlines; i++) _monitorButton->drawImage(0, i * _monitorButtonHeight); } else if (isinteractive) { - _graphics->setPen(0); - _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, textRect.bottom); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, textRect.bottom, 0); } else { - _graphics->setPen(0); - _graphics->rectFill(textRect); + _graphics->rectFill(textRect, 0); } while (drawingToPage < _monitorPage) { @@ -469,8 +465,7 @@ void LabEngine::doMonitor(const Common::String background, const Common::String _event->mouseHide(); _graphics->closeFont(&monitorFont); - _graphics->setPen(0); - _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1); + _graphics->rectFill(0, 0, _graphics->_screenWidth - 1, _graphics->_screenHeight - 1, 0); _graphics->blackAllScreen(); _graphics->freePict(); } diff --git a/engines/lab/tilepuzzle.cpp b/engines/lab/tilepuzzle.cpp index bea2b61ec4..8f21cee4b4 100644 --- a/engines/lab/tilepuzzle.cpp +++ b/engines/lab/tilepuzzle.cpp @@ -208,8 +208,7 @@ void TilePuzzle::doTile(bool showsolution) { rows = _vm->_utils->vgaScaleY(31); cols = _vm->_utils->vgaScaleX(105); } else { - _vm->_graphics->setPen(0); - _vm->_graphics->rectFillScaled(97, 22, 220, 126); + _vm->_graphics->rectFillScaled(97, 22, 220, 126, 0); rowm = _vm->_utils->vgaScaleY(25); colm = _vm->_utils->vgaScaleX(30); |