From 2560fdb19145cf3b035f6cb24b048adec1b656f1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 26 Dec 2015 14:26:33 +0100 Subject: LAB: Make private some DispMan functions and variables, some renaming --- engines/lab/dispman.cpp | 12 +++--- engines/lab/dispman.h | 101 ++++++++++++++++++++++------------------------ engines/lab/interface.cpp | 2 +- 3 files changed, 56 insertions(+), 59 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index a2c83f834b..2dde42ba9b 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -57,7 +57,7 @@ DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _screenHeight = 0; for (int i = 0; i < 256 * 3; i++) - _curvgapal[i] = 0; + _curVgaPal[i] = 0; } DisplayMan::~DisplayMan() { @@ -454,11 +454,11 @@ void DisplayMan::writeColorRegs(byte *buf, uint16 first, uint16 numReg) { tmp[i] = (buf[i] << 2) | (buf[i] >> 4); // better results than buf[i] * 4 _vm->_system->getPaletteManager()->setPalette(tmp, first, numReg); - memcpy(&(_curvgapal[first * 3]), buf, numReg * 3); + memcpy(&(_curVgaPal[first * 3]), buf, numReg * 3); } void DisplayMan::setPalette(void *newPal, uint16 numColors) { - if (memcmp(newPal, _curvgapal, numColors * 3) != 0) + if (memcmp(newPal, _curVgaPal, numColors * 3) != 0) writeColorRegs((byte *)newPal, 0, numColors); } @@ -469,7 +469,7 @@ byte *DisplayMan::getCurrentDrawingBuffer() { return _displayBuffer; } -void DisplayMan::checkerboardEffect(uint16 penColor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { +void DisplayMan::checkerBoardEffect(uint16 penColor, uint16 x1, uint16 y1, uint16 x2, uint16 y2) { int w = x2 - x1 + 1; int h = y2 - y1 + 1; @@ -758,7 +758,7 @@ void DisplayMan::doTransWipe(const Common::String filename) { } if (j == 0) - checkerboardEffect(0, 0, curY, _screenWidth - 1, curY + 1); + checkerBoardEffect(0, 0, curY, _screenWidth - 1, curY + 1); else rectFill(0, curY, _screenWidth - 1, curY + 1, 0); curY += 4; @@ -804,7 +804,7 @@ void DisplayMan::doTransWipe(const Common::String filename) { if (j == 0) { imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false); - checkerboardEffect(0, 0, curY, _screenWidth - 1, curY + 1); + checkerBoardEffect(0, 0, curY, _screenWidth - 1, curY + 1); } else { uint16 bitmapHeight = (curY == lastY) ? 1 : 2; imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, bitmapHeight, false); diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index 19d40b9227..6d70172f17 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -70,22 +70,12 @@ private: */ Common::String getWord(const char *mainBuffer); - byte _curPen; - Common::File *_curBitmap; - byte _curvgapal[256 * 3]; - -public: - DisplayMan(LabEngine *lab); - virtual ~DisplayMan(); - - void loadPict(const Common::String filename); - void loadBackPict(const Common::String fileName, uint16 *highPal); + void createBox(uint16 y2); /** - * Reads in a picture into the display bitmap. + * Sets up either a low-res or a high-res 256 color screen. */ - void readPict(const Common::String filename, bool playOnce = true, bool onlyDiffData = false, byte *memoryBuffer = nullptr); - void freePict(); + void createScreen(bool hiRes); /** * Scrolls the display to black. @@ -108,6 +98,51 @@ public: */ void doTransWipe(const Common::String filename); + /** + * Draws a vertical line. + */ + void drawHLine(uint16 x, uint16 y1, uint16 y2, byte color); + + /** + * Draws a horizontal line. + */ + void drawVLine(uint16 x1, uint16 y, uint16 x2, byte color); + + /** + * Draws the text to the screen. + */ + void drawText(TextFont *tf, uint16 x, uint16 y, uint16 color, const Common::String text); + + /** + * Gets a line of text for flowText; makes sure that its length is less than + * or equal to the maximum width. + */ + Common::String getLine(TextFont *tf, const char **mainBuffer, uint16 lineWidth); + + /** + * Returns the length of a text in the specified font. + */ + uint16 textLength(TextFont *font, const Common::String text); + + bool _actionMessageShown; + byte _curPen; + Common::File *_curBitmap; + byte _curVgaPal[256 * 3]; + byte *_currentDisplayBuffer; + +public: + DisplayMan(LabEngine *lab); + virtual ~DisplayMan(); + + void loadPict(const Common::String filename); + void loadBackPict(const Common::String fileName, uint16 *highPal); + + /** + * Reads in a picture into the display bitmap. + */ + void readPict(const Common::String filename, bool playOnce = true, bool onlyDiffData = false, byte *memoryBuffer = nullptr); + void freePict(); + /** * Does a certain number of pre-programmed wipes. */ @@ -127,7 +162,6 @@ public: * Changes the entire screen to black. */ void blackAllScreen(); - void createBox(uint16 y2); /** * Draws the control panel display. @@ -148,11 +182,6 @@ public: void setActionMessage(bool val) { _actionMessageShown = val; } - /** - * Sets the pen number to use on all the drawing operations. - */ - void setPen(byte pennum); - /** * Fills in a rectangle. */ @@ -178,22 +207,8 @@ public: int flowText(TextFont *font, int16 spacing, byte penColor, byte backPen, bool fillBack, bool centerh, bool centerv, bool output, Common::Rect textRect, const char *text, Image *targetImage = nullptr); - /** - * Draws a vertical line. - */ - void drawHLine(uint16 x, uint16 y1, uint16 y2, byte color); - - /** - * Draws a horizontal line. - */ - void drawVLine(uint16 x1, uint16 y, uint16 x2, byte color); void screenUpdate(); - /** - * Sets up either a low-res or a high-res 256 color screen. - */ - void createScreen(bool hiRes); - /** * Converts a 16-color Amiga palette to a VGA palette, then sets * the VGA palette. @@ -216,7 +231,7 @@ public: /** * Overlays a region on the screen using the desired pen color. */ - void checkerboardEffect(uint16 penColor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); + void checkerBoardEffect(uint16 penColor, uint16 x1, uint16 y1, uint16 x2, uint16 y2); /** * Returns the base address of the current VGA display. @@ -241,35 +256,17 @@ public: */ void freeFont(TextFont **font); - /** - * Returns the length of a text in the specified font. - */ - uint16 textLength(TextFont *font, const Common::String text); - /** * Returns the height of a specified font. */ uint16 textHeight(TextFont *tf); - /** - * Draws the text to the screen. - */ - void drawText(TextFont *tf, uint16 x, uint16 y, uint16 color, const Common::String text); - - /** - * Gets a line of text for flowText; makes sure that its length is less than - * or equal to the maximum width. - */ - Common::String getLine(TextFont *tf, const char **mainBuffer, uint16 lineWidth); - bool _longWinInFront; bool _lastMessageLong; - bool _actionMessageShown; uint32 _screenBytesPerPage; int _screenWidth; int _screenHeight; byte *_displayBuffer; - byte *_currentDisplayBuffer; uint16 *_fadePalette; }; diff --git a/engines/lab/interface.cpp b/engines/lab/interface.cpp index 507e0b27d5..7e57494390 100644 --- a/engines/lab/interface.cpp +++ b/engines/lab/interface.cpp @@ -78,7 +78,7 @@ void EventManager::drawButtonList(ButtonList *buttonList) { void EventManager::toggleButton(Button *button, uint16 disabledPenColor, bool enable) { if (!enable) - _vm->_graphics->checkerboardEffect(disabledPenColor, button->_x, button->_y, button->_x + button->_image->_width - 1, button->_y + button->_image->_height - 1); + _vm->_graphics->checkerBoardEffect(disabledPenColor, button->_x, button->_y, button->_x + button->_image->_width - 1, button->_y + button->_image->_height - 1); else button->_image->drawImage(button->_x, button->_y); -- cgit v1.2.3