From af289bdb03d7f0a5e8f01c03e462f230835e0077 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 16 Jul 2009 17:29:31 +0000 Subject: [PATCH] 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 | 2170 ++++++++--------- gui/themes/scummclassic.zip | Bin 52802 -> 53307 bytes gui/themes/scummclassic/classic_layout.stx | 20 +- .../scummclassic/classic_layout_lowres.stx | 2 +- gui/themes/scummmodern.zip | Bin 157460 -> 157995 bytes .../scummmodern/scummmodern_layout_lowres.stx | 6 +- 9 files changed, 1116 insertions(+), 1111 deletions(-) diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 9fb107f9fcc..54ade5b7ca9 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 290b3450dc4..996ff0e7a75 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 4a7a301faf0..b68f4822d86 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 b7db2a6b62a..0331c90fbb9 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1,4 +1,1088 @@ "" +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " +" " " " " " " " @@ -688,7 +1772,7 @@ " " " " " " -" " +" " " " " " " " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index 7c21b78a3fe8450b7fafd036733bc61ae2a27c8b..ce21ea54870f720a79fa20223965f14d3d234e22 100644 GIT binary patch delta 951 zcmX>!hk5q`X5IjAW)=|!5MavuFp)QyuYCFkE34aC>#D;T7^=fIyOqCWuD4RiC@Co@ zw$j%xPA<*OEz8v_F3Zy^&Mz%WPEE@%N>A0xOD)kaF3T&*&o67|+a zB^jx?sl^b9=`yC>@`ZSeaj1qE}o}p`gO0psS$bnPQ~?k<>?#H8C+lUUfs&fW?-SCU}Q4+Acy4U+jTXp%m(TT zlMlAaPLAM}XEHLFET|+qc^a=GjCqY$8N{3@B{ezAf^V`@Yb_&0&D~acC`+nMkcL$~5)gRp1x z3CHxb3ao*c9G|WYl`=6hH8etmps9kPg_VJ+m9cr0LQZ~BN=AN3zQSg?C@EP!<=G#s zHm^DUz$T1=!6s~D-Us^l0g@KtbMniJQj1Z214|RIB!R5R#L&bH<}Wi{Ln8$P3o8Qy zD5(Xv^6j&-fv5q_A)ez=JYuU-K+LS?}3nir{*KOpREWlsOXabg4%`eYrGWnyA++_a-w#o1L zrNH8HlPx=B!N&MIY;G5r>A+~TSuyYt>twz2+)Nx-CtII45=8Yn1B2w`y7Tgr{cE{( z0=yZSM3^Drgz8fU27YkpLBNtmiLl9M&&wL1dX|Af2t|=zIRis-PGWI!W^#N^Vr715 O$z;U~B5cNIL8<__Hi1$A diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index a55f322ce41..e886a1a2f0d 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -54,7 +54,7 @@ /> @@ -745,7 +745,7 @@ height = 'Globals.Line.Height' /> - + z3AQ9z@(GQ|Q=I-q7*A51Deqmk@f3An{>9B7z7iC^Q2fdMSLcAIQmq-Xvx>#nGUry6|!4-t(O^eCK|5 z;&ti$H>J+b4ywq7%muP>%XtQ5WA?f2g2RmCRDd#LW5wyB-II3=(KFt5_~3bjOw^Lm zVO&XuqF~p{-r@zSM`YrfHjoy5zH~UFC|Sju&L+KSHIoWUQ8g8lyh%y(rL)PDs%jgY z&8Vd^$$nofBm1gzwjuVAoH4T&pK{TQ?ByP4r`5Df*SZ# zPJ$BbXLh`c{9`Jtd!wx`vbu=tj%;fozFN;*&C(c|D6v%By-XfTP@S_F4xtJQ>1YO{ zKUie@Uz(23H?CG9WTMQ{!1e&6xRl7Ic!5pu-e@?yt(Lrypr)k$DMkr3rjlb4RM*Ld z*c+Rhi&F@hpe-H4HZl{1z4aF3bRkq_VSO(J(hvntyKIQju^%Hg3Lz5?3yTf|3df~z bf1f(&?NbIiJBn>4!GRp;9Uvq|0U`7Yy=QR8 delta 765 zcmZuuOK1~O6uomN4U?Fp)%+SmG^J^=U}9@)tU;mBx~Nf1i4{SiG?V$z&NMM&B*h=8 z2yR@I5uYgTvWl&!Sq$Q);MSIEm{oA$wt}`Bmm)8MA#D$w#eJN6-r?NWUu{n}Y|d1Y zwRnI6Idj>WM$R<+Jod5rk4_tMW^K(e!XjtB%iM6#@ptExh0cb1l?nKeGas(Z87p(l z3p;&`ePYJO4{~P0IBi}%a}9vf2V_b@kI`#KljS1za5Nm5%onU3YkAbzxxmm&rpaAxB8-R0-~ z768hwwxxg@fG-xbTwz92XBB0?FHfD{?EmEjpmeout9}4kP;M87PDYiXn8@?HaEK8^w?IVrcF|Eo*)#(d)dl5Jl+W-In diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 13346a1d6f4..693efaaca97 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -732,14 +732,14 @@ - - + +