From b8c7237d12ac766dc5db9a5731e3e50f0715cd09 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 30 Sep 2009 14:53:34 +0000 Subject: Cleanup: got rid of Screen::ShadeType. svn-id: r44487 --- engines/kyra/gui.cpp | 4 ++-- engines/kyra/gui_lol.cpp | 4 ++-- engines/kyra/screen.cpp | 22 +++++----------------- engines/kyra/screen.h | 6 +----- engines/kyra/screen_lol.cpp | 18 ++++++++++++++++++ engines/kyra/screen_lol.h | 2 ++ 6 files changed, 30 insertions(+), 26 deletions(-) (limited to 'engines') diff --git a/engines/kyra/gui.cpp b/engines/kyra/gui.cpp index e2bf8091f3..0533e55574 100644 --- a/engines/kyra/gui.cpp +++ b/engines/kyra/gui.cpp @@ -83,7 +83,7 @@ void GUI::initMenu(Menu &menu) { int menu_y2 = menu.height + menu.y - 1; _screen->fillRect(menu.x + 2, menu.y + 2, menu_x2 - 2, menu_y2 - 2, menu.bkgdColor); - _screen->drawShadedBox(menu.x, menu.y, menu_x2, menu_y2, menu.color1, menu.color2, _vm->gameFlags().gameID == GI_LOL ? Screen::kShadeTypeLol : Screen::kShadeTypeKyra); + _screen->drawShadedBox(menu.x, menu.y, menu_x2, menu_y2, menu.color1, menu.color2); if (menu.titleX != -1) textX = menu.titleX; @@ -127,7 +127,7 @@ void GUI::initMenu(Menu &menu) { } _screen->fillRect(x1, y1, x2, y2, menu.item[i].bkgdColor); - _screen->drawShadedBox(x1, y1, x2, y2, menu.item[i].color1, menu.item[i].color2, _vm->gameFlags().gameID == GI_LOL ? Screen::kShadeTypeLol : Screen::kShadeTypeKyra); + _screen->drawShadedBox(x1, y1, x2, y2, menu.item[i].color1, menu.item[i].color2); if (getMenuItemTitle(menu.item[i])) { if (menu.item[i].titleX != -1) diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp index 4f8c373fd2..632d4c38b3 100644 --- a/engines/kyra/gui_lol.cpp +++ b/engines/kyra/gui_lol.cpp @@ -2291,7 +2291,7 @@ int GUI_LoL::redrawShadedButtonCallback(Button *button) { if (!_displayMenu || _vm->gameFlags().use16ColorMode) return 0; - _screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 223, 227, Screen::kShadeTypeLol); + _screen->drawShadedBox(button->x, button->y, button->x + button->width, button->y + button->height, 223, 227); return 0; } @@ -2465,7 +2465,7 @@ int GUI_LoL::runMenu(Menu &menu) { int my = d->sy - 1; int mw = (d->w << 3) + 1; int mh = d->h + 1; - _screen->drawShadedBox(mx, my, mx + mw, my + mh, 227, 223, Screen::kShadeTypeLol); + _screen->drawShadedBox(mx, my, mx + mw, my + mh, 227, 223); int pg = _screen->setCurPage(0); _vm->_txt->clearDim(8); textCursorTimer = 0; diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 5a7bbc4f9a..aeeb511dd1 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -996,30 +996,18 @@ void Screen::drawBox(int x1, int y1, int x2, int y2, int color) { drawClippedLine(x1, y2, x2, y2, color); } -void Screen::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2, ShadeType shadeType) { +void Screen::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2) { assert(x1 >= 0 && y1 >= 0); hideMouse(); fillRect(x1, y1, x2, y1 + 1, color1); - if (shadeType == kShadeTypeLol) - fillRect(x1, y1, x1 + 1, y2, color1); - else - fillRect(x2 - 1, y1, x2, y2, color1); + fillRect(x2 - 1, y1, x2, y2, color1); - if (shadeType == kShadeTypeLol) { - drawClippedLine(x2, y1, x2, y2, color2); - drawClippedLine(x2 - 1, y1 + 1, x2 - 1, y2 - 1, color2); - drawClippedLine(x1 + 1, y2 - 1, x2, y2 - 1, color2); - } else { - drawClippedLine(x1, y1, x1, y2, color2); - drawClippedLine(x1 + 1, y1 + 1, x1 + 1, y2 - 1, color2); - drawClippedLine(x1, y2 - 1, x2 - 1, y2 - 1, color2); - } + drawClippedLine(x1, y1, x1, y2, color2); + drawClippedLine(x1 + 1, y1 + 1, x1 + 1, y2 - 1, color2); + drawClippedLine(x1, y2 - 1, x2 - 1, y2 - 1, color2); drawClippedLine(x1, y2, x2, y2, color2); - if (shadeType == kShadeTypeLol && _use16ColorMode) - drawBox(x1, y1, x2, y2, 0); - showMouse(); } diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index c2eabb668e..d4e44c1651 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -364,13 +364,9 @@ public: void copyPalette(const int dst, const int src); // gui specific (processing on _curPage) - enum ShadeType { - kShadeTypeKyra, - kShadeTypeLol - }; void drawLine(bool vertical, int x, int y, int length, int color); void drawClippedLine(int x1, int y1, int x2, int y2, int color); - void drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2, ShadeType shadeType = kShadeTypeKyra); + virtual void drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2); void drawBox(int x1, int y1, int x2, int y2, int color); // font/text handling diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index 6ad1b86e47..624f8d57df 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -149,6 +149,24 @@ void Screen_LoL::fprintStringIntro(const char *format, int x, int y, uint8 c1, u printText(buffer, x, y, c1, c2); } +void Screen_LoL::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2) { + assert(x1 >= 0 && y1 >= 0); + hideMouse(); + + fillRect(x1, y1, x2, y1 + 1, color1); + fillRect(x1, y1, x1 + 1, y2, color1); + + drawClippedLine(x2, y1, x2, y2, color2); + drawClippedLine(x2 - 1, y1 + 1, x2 - 1, y2 - 1, color2); + drawClippedLine(x1 + 1, y2 - 1, x2, y2 - 1, color2); + drawClippedLine(x1, y2, x2, y2, color2); + + if (_use16ColorMode) + drawBox(x1, y1, x2, y2, 0); + + showMouse(); +} + void Screen_LoL::generateGrayOverlay(const Palette &srcPal, uint8 *grayOverlay, int factor, int addR, int addG, int addB, int lastColor, bool skipSpecialColors) { Palette tmpPal(lastColor); diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index 7916cf0aca..293d0ef42c 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -49,6 +49,8 @@ public: void fprintString(const char *format, int x, int y, uint8 col1, uint8 col2, uint16 flags, ...) GCC_PRINTF(2, 8); void fprintStringIntro(const char *format, int x, int y, uint8 c1, uint8 c2, uint8 c3, uint16 flags, ...) GCC_PRINTF(2, 9); + void drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2); + void drawGridBox(int x, int y, int w, int h, int col); void fadeClearSceneWindow(int delay); -- cgit v1.2.3