From af289bdb03d7f0a5e8f01c03e462f230835e0077 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 16 Jul 2009 17:29:31 +0000 Subject: Fixed bug 2820514 ("Help dialog causes crash") svn-id: r42537 --- engines/scumm/dialogs.cpp | 16 +- engines/scumm/dialogs.h | 1 + graphics/VectorRendererSpec.cpp | 12 +- gui/themes/default.inc | 632 ++++++++++----------- gui/themes/scummclassic.zip | Bin 52802 -> 53307 bytes gui/themes/scummclassic/classic_layout.stx | 20 +- gui/themes/scummclassic/classic_layout_lowres.stx | 2 +- gui/themes/scummmodern.zip | Bin 157460 -> 157995 bytes .../scummmodern/scummmodern_layout_lowres.stx | 6 +- 9 files changed, 347 insertions(+), 342 deletions(-) diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 9fb107f9fc..54ade5b7ca 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -641,6 +641,8 @@ HelpDialog::HelpDialog(const GameSettings &game) new GUI::ButtonWidget(this, "ScummHelp.Close", "Close", kCloseCmd, 'C'); _prevButton->clearFlags(WIDGET_ENABLED); + _numLines = HELP_NUM_LINES; + // Dummy entries for (int i = 0; i < HELP_NUM_LINES; i++) { _key[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", Graphics::kTextAlignRight); @@ -658,15 +660,20 @@ void HelpDialog::reflowLayout() { g_gui.xmlEval()->getWidgetData("ScummHelp.HelpText", x, y, w, h); + /* Make sure than we don't have more lines than what we can fit + * on the space that the layout reserves for text */ + _numLines = MIN(HELP_NUM_LINES, (int)(h / lineHeight)); + + int keyW = w * 20 / 100; int dscX = x + keyW + 32; int dscW = w * 80 / 100; int xoff = (_w >> 1) - (w >> 1); - for (int i = 0; i < HELP_NUM_LINES; i++) { - _key[i]->resize(xoff + x, y + lineHeight * i, keyW, lineHeight + 2); - _dsc[i]->resize(xoff + dscX, y + lineHeight * i, dscW, lineHeight + 2); + for (int i = 0; i < _numLines; i++) { + _key[i]->resize(xoff + x, y + lineHeight * i, keyW, lineHeight); + _dsc[i]->resize(xoff + dscX, y + lineHeight * i, dscW, lineHeight); } displayKeyBindings(); @@ -675,6 +682,7 @@ void HelpDialog::reflowLayout() { void HelpDialog::displayKeyBindings() { String titleStr, *keyStr, *dscStr; + int i; #ifndef __DS__ ScummHelp::updateStrings(_game.id, _game.version, _game.platform, _page, titleStr, keyStr, dscStr); @@ -684,7 +692,7 @@ void HelpDialog::displayKeyBindings() { #endif _title->setLabel(titleStr); - for (int i = 0; i < HELP_NUM_LINES; i++) { + for (i = 0; i < _numLines; i++) { _key[i]->setLabel(keyStr[i]); _dsc[i]->setLabel(dscStr[i]); } diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index 290b3450dc..996ff0e7a7 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -124,6 +124,7 @@ protected: int _page; int _numPages; + int _numLines; const GameSettings _game; diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 4a7a301faf..b68f4822d8 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -596,8 +596,6 @@ drawSquare(int x, int y, int w, int h) { template void VectorRendererSpec:: drawRoundedSquare(int x, int y, int r, int w, int h) { - x++; y++; w--; h--; - if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || w <= 0 || h <= 0 || x < 0 || y < 0 || r <= 0) return; @@ -606,8 +604,8 @@ drawRoundedSquare(int x, int y, int r, int w, int h) { r = MIN(w /2, h / 2); if (Base::_fillMode != kFillDisabled && Base::_shadowOffset - && x + w + Base::_shadowOffset < Base::_activeSurface->w - && y + h + Base::_shadowOffset < Base::_activeSurface->h) { + && x + w + Base::_shadowOffset + 1 < Base::_activeSurface->w + && y + h + Base::_shadowOffset + 1 < Base::_activeSurface->h) { drawRoundedSquareShadow(x, y, r, w, h, Base::_shadowOffset); } @@ -922,13 +920,11 @@ drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, P int i, j; -#if 0 x = MAX(x - bevel, 0); y = MAX(y - bevel, 0); - w = w + (bevel * 2); - h = h + (bevel * 2); -#endif + w = MIN(w + (bevel * 2), (int)_activeSurface->w); + h = MIN(h + (bevel * 2), (int)_activeSurface->h); PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y); diff --git a/gui/themes/default.inc b/gui/themes/default.inc index b7db2a6b62..0331c90fbb 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1,38 +1,41 @@ "" -" " +" " " " -" " -" " -" " -" " +" " +" " +" " +" " " " " " " " -" " -" " -" " -" " -" " -" " +" " +" " +" " +" " " " " " +" " +" " +" " " " " " " " " " " " " " " " " " " " -" " +" " " " " " " " @@ -79,36 +82,37 @@ " " " " " " " " " " " " " " +" " " " " " " " " " " " " " " " " " -" " -" " +" " +" " " " @@ -116,7 +120,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -130,10 +134,10 @@ " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -154,7 +158,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -172,7 +176,7 @@ " " " " " " -" " +" " " " @@ -180,7 +184,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -188,7 +192,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -196,16 +200,16 @@ "type='PopUp' " "/> " " " -" " +" " " " " " " " -" " +" " " " @@ -219,8 +223,9 @@ " " " " " " -" " -" " +" " +" " +" " " " @@ -231,7 +236,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -242,7 +247,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -253,8 +258,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -263,7 +268,7 @@ " " " " " " -" " +" " " " @@ -284,7 +289,7 @@ " " -" " +" " " " @@ -300,7 +305,7 @@ " " " " " " -" " +" " " " @@ -308,7 +313,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -316,7 +321,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -336,7 +341,7 @@ " " " " " " -" " +" " " " @@ -344,21 +349,17 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " " " " " -" " +" " " " " " " " -" " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -494,7 +486,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -502,7 +494,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -513,86 +505,81 @@ " " " " " " -" " +" " " " " " -" " +" " +" " " " " " -" " +" " " " " " -" " -" " +" " " " " " " " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " -" " +" " " " " " " " " " " " -" " +" " +" " +" " " " @@ -603,7 +590,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -614,7 +601,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -625,24 +612,25 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " " " -" " -" " +" " +" " +" " " " " " " " -" " +" " " " @@ -653,8 +641,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -669,15 +657,23 @@ " " " " " " -" " -" " +" " +" " +" " " " -" " +" " +" " +" " " " " " -" " +" " " " @@ -687,16 +683,16 @@ " " " " " " -" " -" " +" " +" " " " " " -" " +" " " " @@ -711,20 +707,20 @@ " " " " " " -" " +" " " " " " " " -" " +" " " " @@ -735,20 +731,20 @@ " " " " " " -" " +" " " " " " " " " " " " " " " " " " -" " +" " " " -" " -" " -" " -" " +" " +" " +" " +" " " " " " " " -" " -" " -" " -" " +" " +" " +" " +" " +" " +" " " " " " -" " -" " -" " " " " " " " " " " " " " " " " " " " -" " +" " " " " " " " @@ -1170,37 +1163,36 @@ " " " " " " " " " " " " " " -" " " " " " " " " " " " " " " " " " -" " -" " +" " +" " " " @@ -1208,7 +1200,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1222,10 +1214,10 @@ " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -1246,7 +1238,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1264,7 +1256,7 @@ " " " " " " -" " +" " " " @@ -1272,7 +1264,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1280,7 +1272,7 @@ "type='PopUp' " "/> " " " -" " +" " " " @@ -1288,16 +1280,16 @@ "type='PopUp' " "/> " " " -" " +" " " " " " " " -" " +" " " " @@ -1311,9 +1303,8 @@ " " " " " " -" " -" " -" " +" " +" " " " @@ -1324,7 +1315,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1335,7 +1326,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1346,8 +1337,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -1356,7 +1347,7 @@ " " " " " " -" " +" " " " @@ -1377,7 +1368,7 @@ " " -" " +" " " " @@ -1393,7 +1384,7 @@ " " " " " " -" " +" " " " @@ -1401,7 +1392,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1409,7 +1400,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1429,7 +1420,7 @@ " " " " " " -" " +" " " " @@ -1437,17 +1428,21 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " " " -" " +" " " " " " " " -" " +" " " " " " " " -" " +" " +" " " " " " " " -" " +" " " " " " " " " " -" " +" " " " @@ -1574,7 +1578,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1582,7 +1586,7 @@ "height='Globals.Line.Height' " "/> " " " -" " +" " " " @@ -1593,81 +1597,86 @@ " " " " " " -" " +" " " " " " -" " -" " +" " " " " " -" " +" " " " " " +" " +" " -" " " " " " " " " " " " " " " " -" " +" " " " " " -" " +" " " " " " " " -" " +" " " " " " " " " " " " -" " -" " -" " +" " " " @@ -1678,7 +1687,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1689,7 +1698,7 @@ "type='SmallLabel' " "/> " " " -" " +" " " " @@ -1700,25 +1709,24 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " " " -" " -" " -" " +" " +" " " " " " " " -" " +" " " " @@ -1729,8 +1737,8 @@ "type='SmallLabel' " "/> " " " -" " -" " +" " +" " " " @@ -1745,23 +1753,15 @@ " " " " " " -" " -" " -" " +" " +" " " " -" " -" " -" " +" " " " " " -" " +" " " " @@ -1771,16 +1771,16 @@ " " " " " " -" " -" " +" " +" " " " " " -" " +" " " " @@ -1795,20 +1795,20 @@ " " " " " " -" " +" " " " " " " " -" " +" " " " @@ -1819,20 +1819,20 @@ " " " " " " -" " +" " " " " " " " " " " " " @@ -745,7 +745,7 @@ height = 'Globals.Line.Height' /> - + - - + +